From 242ef35d28e2aa0a39320939325e88680ba0de10 Mon Sep 17 00:00:00 2001 From: Shravan Sunder Date: Sun, 2 Jan 2022 19:07:00 -0500 Subject: [PATCH 01/21] updated docs --- .../EthersContext.CouldNotActivateError.md | 2 +- .../EthersContext.EthersModalConnector.md | 44 ++++++++--------- ...ersContext.NoEthereumProviderFoundError.md | 2 +- .../EthersContext.UserClosedModalError.md | 2 +- .../EthersContext.ICommonModalConnector.md | 8 ++-- .../EthersContext.IEthersContext.md | 20 ++++---- ....IStaticJsonRpcProviderConnectorOptions.md | 4 +- .../Models.IContractFactoryBridge.md | 2 +- .../interfaces/Models.TypedEvent.md | 2 +- docs/api-typedocs/modules/EthersContext.md | 16 +++---- docs/api-typedocs/modules/Helpers.md | 2 +- docs/api-typedocs/modules/Hooks.md | 48 +++++++++---------- docs/api-typedocs/modules/Models.md | 24 +++++----- docs/api-typedocs/modules/TestUtils.md | 26 +++++----- package.json | 2 +- 15 files changed, 102 insertions(+), 102 deletions(-) diff --git a/docs/api-typedocs/classes/EthersContext.CouldNotActivateError.md b/docs/api-typedocs/classes/EthersContext.CouldNotActivateError.md index c46220df..5c16bc8a 100644 --- a/docs/api-typedocs/classes/EthersContext.CouldNotActivateError.md +++ b/docs/api-typedocs/classes/EthersContext.CouldNotActivateError.md @@ -162,4 +162,4 @@ Error.constructor #### Defined in -[src/context/connectors/connectorErrors.ts:16](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/context/connectors/connectorErrors.ts#L16) +[src/context/connectors/connectorErrors.ts:16](https://github.com/scaffold-eth/eth-hooks/blob/cec59cb/src/context/connectors/connectorErrors.ts#L16) diff --git a/docs/api-typedocs/classes/EthersContext.EthersModalConnector.md b/docs/api-typedocs/classes/EthersContext.EthersModalConnector.md index 938f5837..7cb06edd 100644 --- a/docs/api-typedocs/classes/EthersContext.EthersModalConnector.md +++ b/docs/api-typedocs/classes/EthersContext.EthersModalConnector.md @@ -1130,7 +1130,7 @@ ___ #### Defined in -[src/context/connectors/EthersModalConnector.ts:102](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/context/connectors/EthersModalConnector.ts#L102) +[src/context/connectors/EthersModalConnector.ts:102](https://github.com/scaffold-eth/eth-hooks/blob/cec59cb/src/context/connectors/EthersModalConnector.ts#L102) ___ @@ -1161,7 +1161,7 @@ AbstractConnector.activate #### Defined in -[src/context/connectors/EthersModalConnector.ts:170](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/context/connectors/EthersModalConnector.ts#L170) +[src/context/connectors/EthersModalConnector.ts:170](https://github.com/scaffold-eth/eth-hooks/blob/cec59cb/src/context/connectors/EthersModalConnector.ts#L170) ___ @@ -1182,7 +1182,7 @@ AbstractConnector.deactivate #### Defined in -[src/context/connectors/EthersModalConnector.ts:228](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/context/connectors/EthersModalConnector.ts#L228) +[src/context/connectors/EthersModalConnector.ts:228](https://github.com/scaffold-eth/eth-hooks/blob/cec59cb/src/context/connectors/EthersModalConnector.ts#L228) ___ @@ -1200,7 +1200,7 @@ AbstractConnector.getProvider #### Defined in -[src/context/connectors/EthersModalConnector.ts:248](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/context/connectors/EthersModalConnector.ts#L248) +[src/context/connectors/EthersModalConnector.ts:248](https://github.com/scaffold-eth/eth-hooks/blob/cec59cb/src/context/connectors/EthersModalConnector.ts#L248) ___ @@ -1218,7 +1218,7 @@ AbstractConnector.getChainId #### Defined in -[src/context/connectors/EthersModalConnector.ts:252](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/context/connectors/EthersModalConnector.ts#L252) +[src/context/connectors/EthersModalConnector.ts:252](https://github.com/scaffold-eth/eth-hooks/blob/cec59cb/src/context/connectors/EthersModalConnector.ts#L252) ___ @@ -1236,7 +1236,7 @@ AbstractConnector.getAccount #### Defined in -[src/context/connectors/EthersModalConnector.ts:262](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/context/connectors/EthersModalConnector.ts#L262) +[src/context/connectors/EthersModalConnector.ts:262](https://github.com/scaffold-eth/eth-hooks/blob/cec59cb/src/context/connectors/EthersModalConnector.ts#L262) ___ @@ -1254,7 +1254,7 @@ ___ #### Defined in -[src/context/connectors/EthersModalConnector.ts:274](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/context/connectors/EthersModalConnector.ts#L274) +[src/context/connectors/EthersModalConnector.ts:274](https://github.com/scaffold-eth/eth-hooks/blob/cec59cb/src/context/connectors/EthersModalConnector.ts#L274) ___ @@ -1281,7 +1281,7 @@ Change the current signer and account used by the connector #### Defined in -[src/context/connectors/EthersModalConnector.ts:283](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/context/connectors/EthersModalConnector.ts#L283) +[src/context/connectors/EthersModalConnector.ts:283](https://github.com/scaffold-eth/eth-hooks/blob/cec59cb/src/context/connectors/EthersModalConnector.ts#L283) ___ @@ -1295,7 +1295,7 @@ ___ #### Defined in -[src/context/connectors/EthersModalConnector.ts:294](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/context/connectors/EthersModalConnector.ts#L294) +[src/context/connectors/EthersModalConnector.ts:294](https://github.com/scaffold-eth/eth-hooks/blob/cec59cb/src/context/connectors/EthersModalConnector.ts#L294) ___ @@ -1316,7 +1316,7 @@ Resets the web3Modal and clears the cache #### Defined in -[src/context/connectors/EthersModalConnector.ts:302](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/context/connectors/EthersModalConnector.ts#L302) +[src/context/connectors/EthersModalConnector.ts:302](https://github.com/scaffold-eth/eth-hooks/blob/cec59cb/src/context/connectors/EthersModalConnector.ts#L302) ___ @@ -1343,7 +1343,7 @@ Sets the web3modal theme: light | dark | ThemeColors #### Defined in -[src/context/connectors/EthersModalConnector.ts:317](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/context/connectors/EthersModalConnector.ts#L317) +[src/context/connectors/EthersModalConnector.ts:317](https://github.com/scaffold-eth/eth-hooks/blob/cec59cb/src/context/connectors/EthersModalConnector.ts#L317) ## Properties @@ -1433,7 +1433,7 @@ ___ #### Defined in -[src/context/connectors/EthersModalConnector.ts:62](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/context/connectors/EthersModalConnector.ts#L62) +[src/context/connectors/EthersModalConnector.ts:62](https://github.com/scaffold-eth/eth-hooks/blob/cec59cb/src/context/connectors/EthersModalConnector.ts#L62) ___ @@ -1443,7 +1443,7 @@ ___ #### Defined in -[src/context/connectors/EthersModalConnector.ts:63](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/context/connectors/EthersModalConnector.ts#L63) +[src/context/connectors/EthersModalConnector.ts:63](https://github.com/scaffold-eth/eth-hooks/blob/cec59cb/src/context/connectors/EthersModalConnector.ts#L63) ___ @@ -1453,7 +1453,7 @@ ___ #### Defined in -[src/context/connectors/EthersModalConnector.ts:64](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/context/connectors/EthersModalConnector.ts#L64) +[src/context/connectors/EthersModalConnector.ts:64](https://github.com/scaffold-eth/eth-hooks/blob/cec59cb/src/context/connectors/EthersModalConnector.ts#L64) ___ @@ -1463,7 +1463,7 @@ ___ #### Defined in -[src/context/connectors/EthersModalConnector.ts:65](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/context/connectors/EthersModalConnector.ts#L65) +[src/context/connectors/EthersModalConnector.ts:65](https://github.com/scaffold-eth/eth-hooks/blob/cec59cb/src/context/connectors/EthersModalConnector.ts#L65) ___ @@ -1473,7 +1473,7 @@ ___ #### Defined in -[src/context/connectors/EthersModalConnector.ts:66](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/context/connectors/EthersModalConnector.ts#L66) +[src/context/connectors/EthersModalConnector.ts:66](https://github.com/scaffold-eth/eth-hooks/blob/cec59cb/src/context/connectors/EthersModalConnector.ts#L66) ___ @@ -1483,7 +1483,7 @@ ___ #### Defined in -[src/context/connectors/EthersModalConnector.ts:67](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/context/connectors/EthersModalConnector.ts#L67) +[src/context/connectors/EthersModalConnector.ts:67](https://github.com/scaffold-eth/eth-hooks/blob/cec59cb/src/context/connectors/EthersModalConnector.ts#L67) ___ @@ -1493,7 +1493,7 @@ ___ #### Defined in -[src/context/connectors/EthersModalConnector.ts:68](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/context/connectors/EthersModalConnector.ts#L68) +[src/context/connectors/EthersModalConnector.ts:68](https://github.com/scaffold-eth/eth-hooks/blob/cec59cb/src/context/connectors/EthersModalConnector.ts#L68) ___ @@ -1503,7 +1503,7 @@ ___ #### Defined in -[src/context/connectors/EthersModalConnector.ts:69](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/context/connectors/EthersModalConnector.ts#L69) +[src/context/connectors/EthersModalConnector.ts:69](https://github.com/scaffold-eth/eth-hooks/blob/cec59cb/src/context/connectors/EthersModalConnector.ts#L69) ___ @@ -1513,7 +1513,7 @@ ___ #### Defined in -[src/context/connectors/EthersModalConnector.ts:70](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/context/connectors/EthersModalConnector.ts#L70) +[src/context/connectors/EthersModalConnector.ts:70](https://github.com/scaffold-eth/eth-hooks/blob/cec59cb/src/context/connectors/EthersModalConnector.ts#L70) ## Constructors @@ -1536,7 +1536,7 @@ AbstractConnector.constructor #### Defined in -[src/context/connectors/EthersModalConnector.ts:82](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/context/connectors/EthersModalConnector.ts#L82) +[src/context/connectors/EthersModalConnector.ts:82](https://github.com/scaffold-eth/eth-hooks/blob/cec59cb/src/context/connectors/EthersModalConnector.ts#L82) ## Accessors @@ -1550,4 +1550,4 @@ AbstractConnector.constructor #### Defined in -[src/context/connectors/EthersModalConnector.ts:72](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/context/connectors/EthersModalConnector.ts#L72) +[src/context/connectors/EthersModalConnector.ts:72](https://github.com/scaffold-eth/eth-hooks/blob/cec59cb/src/context/connectors/EthersModalConnector.ts#L72) diff --git a/docs/api-typedocs/classes/EthersContext.NoEthereumProviderFoundError.md b/docs/api-typedocs/classes/EthersContext.NoEthereumProviderFoundError.md index ec16909f..f5f3d751 100644 --- a/docs/api-typedocs/classes/EthersContext.NoEthereumProviderFoundError.md +++ b/docs/api-typedocs/classes/EthersContext.NoEthereumProviderFoundError.md @@ -156,4 +156,4 @@ Error.constructor #### Defined in -[src/context/connectors/connectorErrors.ts:27](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/context/connectors/connectorErrors.ts#L27) +[src/context/connectors/connectorErrors.ts:27](https://github.com/scaffold-eth/eth-hooks/blob/cec59cb/src/context/connectors/connectorErrors.ts#L27) diff --git a/docs/api-typedocs/classes/EthersContext.UserClosedModalError.md b/docs/api-typedocs/classes/EthersContext.UserClosedModalError.md index 7b2aa73b..4c57b9db 100644 --- a/docs/api-typedocs/classes/EthersContext.UserClosedModalError.md +++ b/docs/api-typedocs/classes/EthersContext.UserClosedModalError.md @@ -156,4 +156,4 @@ Error.constructor #### Defined in -[src/context/connectors/connectorErrors.ts:5](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/context/connectors/connectorErrors.ts#L5) +[src/context/connectors/connectorErrors.ts:5](https://github.com/scaffold-eth/eth-hooks/blob/cec59cb/src/context/connectors/connectorErrors.ts#L5) diff --git a/docs/api-typedocs/interfaces/EthersContext.ICommonModalConnector.md b/docs/api-typedocs/interfaces/EthersContext.ICommonModalConnector.md index 4bdd6d9a..79591539 100644 --- a/docs/api-typedocs/interfaces/EthersContext.ICommonModalConnector.md +++ b/docs/api-typedocs/interfaces/EthersContext.ICommonModalConnector.md @@ -32,7 +32,7 @@ An interface implemented by [EthersModalConnector](../classes/EthersContext.Ethe #### Defined in -[src/context/connectors/EthersModalConnector.ts:39](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/context/connectors/EthersModalConnector.ts#L39) +[src/context/connectors/EthersModalConnector.ts:39](https://github.com/scaffold-eth/eth-hooks/blob/cec59cb/src/context/connectors/EthersModalConnector.ts#L39) ___ @@ -52,7 +52,7 @@ ___ #### Defined in -[src/context/connectors/EthersModalConnector.ts:40](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/context/connectors/EthersModalConnector.ts#L40) +[src/context/connectors/EthersModalConnector.ts:40](https://github.com/scaffold-eth/eth-hooks/blob/cec59cb/src/context/connectors/EthersModalConnector.ts#L40) ___ @@ -66,7 +66,7 @@ ___ #### Defined in -[src/context/connectors/EthersModalConnector.ts:41](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/context/connectors/EthersModalConnector.ts#L41) +[src/context/connectors/EthersModalConnector.ts:41](https://github.com/scaffold-eth/eth-hooks/blob/cec59cb/src/context/connectors/EthersModalConnector.ts#L41) ___ @@ -86,4 +86,4 @@ ___ #### Defined in -[src/context/connectors/EthersModalConnector.ts:42](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/context/connectors/EthersModalConnector.ts#L42) +[src/context/connectors/EthersModalConnector.ts:42](https://github.com/scaffold-eth/eth-hooks/blob/cec59cb/src/context/connectors/EthersModalConnector.ts#L42) diff --git a/docs/api-typedocs/interfaces/EthersContext.IEthersContext.md b/docs/api-typedocs/interfaces/EthersContext.IEthersContext.md index 29c7bf50..0aff0664 100644 --- a/docs/api-typedocs/interfaces/EthersContext.IEthersContext.md +++ b/docs/api-typedocs/interfaces/EthersContext.IEthersContext.md @@ -126,7 +126,7 @@ ___ #### Defined in -[src/context/EthersAppContext.tsx:43](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/context/EthersAppContext.tsx#L43) +[src/context/EthersAppContext.tsx:43](https://github.com/scaffold-eth/eth-hooks/blob/cec59cb/src/context/EthersAppContext.tsx#L43) ___ @@ -140,7 +140,7 @@ ___ #### Defined in -[src/context/EthersAppContext.tsx:44](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/context/EthersAppContext.tsx#L44) +[src/context/EthersAppContext.tsx:44](https://github.com/scaffold-eth/eth-hooks/blob/cec59cb/src/context/EthersAppContext.tsx#L44) ## Properties @@ -182,7 +182,7 @@ Web3ReactContextInterface.connector #### Defined in -[src/context/EthersAppContext.tsx:36](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/context/EthersAppContext.tsx#L36) +[src/context/EthersAppContext.tsx:36](https://github.com/scaffold-eth/eth-hooks/blob/cec59cb/src/context/EthersAppContext.tsx#L36) ___ @@ -192,7 +192,7 @@ ___ #### Defined in -[src/context/EthersAppContext.tsx:37](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/context/EthersAppContext.tsx#L37) +[src/context/EthersAppContext.tsx:37](https://github.com/scaffold-eth/eth-hooks/blob/cec59cb/src/context/EthersAppContext.tsx#L37) ___ @@ -206,7 +206,7 @@ Web3ReactContextInterface.active #### Defined in -[src/context/EthersAppContext.tsx:38](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/context/EthersAppContext.tsx#L38) +[src/context/EthersAppContext.tsx:38](https://github.com/scaffold-eth/eth-hooks/blob/cec59cb/src/context/EthersAppContext.tsx#L38) ___ @@ -216,7 +216,7 @@ ___ #### Defined in -[src/context/EthersAppContext.tsx:39](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/context/EthersAppContext.tsx#L39) +[src/context/EthersAppContext.tsx:39](https://github.com/scaffold-eth/eth-hooks/blob/cec59cb/src/context/EthersAppContext.tsx#L39) ___ @@ -230,7 +230,7 @@ Web3ReactContextInterface.account #### Defined in -[src/context/EthersAppContext.tsx:40](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/context/EthersAppContext.tsx#L40) +[src/context/EthersAppContext.tsx:40](https://github.com/scaffold-eth/eth-hooks/blob/cec59cb/src/context/EthersAppContext.tsx#L40) ___ @@ -244,7 +244,7 @@ Web3ReactContextInterface.chainId #### Defined in -[src/context/EthersAppContext.tsx:41](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/context/EthersAppContext.tsx#L41) +[src/context/EthersAppContext.tsx:41](https://github.com/scaffold-eth/eth-hooks/blob/cec59cb/src/context/EthersAppContext.tsx#L41) ___ @@ -254,7 +254,7 @@ ___ #### Defined in -[src/context/EthersAppContext.tsx:42](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/context/EthersAppContext.tsx#L42) +[src/context/EthersAppContext.tsx:42](https://github.com/scaffold-eth/eth-hooks/blob/cec59cb/src/context/EthersAppContext.tsx#L42) ___ @@ -264,4 +264,4 @@ ___ #### Defined in -[src/context/EthersAppContext.tsx:45](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/context/EthersAppContext.tsx#L45) +[src/context/EthersAppContext.tsx:45](https://github.com/scaffold-eth/eth-hooks/blob/cec59cb/src/context/EthersAppContext.tsx#L45) diff --git a/docs/api-typedocs/interfaces/EthersContext.IStaticJsonRpcProviderConnectorOptions.md b/docs/api-typedocs/interfaces/EthersContext.IStaticJsonRpcProviderConnectorOptions.md index 7d72de2f..b67f74ea 100644 --- a/docs/api-typedocs/interfaces/EthersContext.IStaticJsonRpcProviderConnectorOptions.md +++ b/docs/api-typedocs/interfaces/EthersContext.IStaticJsonRpcProviderConnectorOptions.md @@ -48,7 +48,7 @@ ___ #### Defined in -[src/context/connectors/StaticJsonRpcProviderConnector.ts:12](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/context/connectors/StaticJsonRpcProviderConnector.ts#L12) +[src/context/connectors/StaticJsonRpcProviderConnector.ts:12](https://github.com/scaffold-eth/eth-hooks/blob/cec59cb/src/context/connectors/StaticJsonRpcProviderConnector.ts#L12) ___ @@ -58,4 +58,4 @@ ___ #### Defined in -[src/context/connectors/StaticJsonRpcProviderConnector.ts:13](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/context/connectors/StaticJsonRpcProviderConnector.ts#L13) +[src/context/connectors/StaticJsonRpcProviderConnector.ts:13](https://github.com/scaffold-eth/eth-hooks/blob/cec59cb/src/context/connectors/StaticJsonRpcProviderConnector.ts#L13) diff --git a/docs/api-typedocs/interfaces/Models.IContractFactoryBridge.md b/docs/api-typedocs/interfaces/Models.IContractFactoryBridge.md index dcc955f9..ab7d7703 100644 --- a/docs/api-typedocs/interfaces/Models.IContractFactoryBridge.md +++ b/docs/api-typedocs/interfaces/Models.IContractFactoryBridge.md @@ -31,4 +31,4 @@ In progress... #### Defined in -[src/models/contractTypes.ts:8](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/models/contractTypes.ts#L8) +[src/models/contractTypes.ts:8](https://github.com/scaffold-eth/eth-hooks/blob/cec59cb/src/models/contractTypes.ts#L8) diff --git a/docs/api-typedocs/interfaces/Models.TypedEvent.md b/docs/api-typedocs/interfaces/Models.TypedEvent.md index 70245fa9..6a5003e0 100644 --- a/docs/api-typedocs/interfaces/Models.TypedEvent.md +++ b/docs/api-typedocs/interfaces/Models.TypedEvent.md @@ -222,7 +222,7 @@ Event.args #### Defined in -[src/models/providerTypes.ts:66](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/models/providerTypes.ts#L66) +[src/models/providerTypes.ts:66](https://github.com/scaffold-eth/eth-hooks/blob/cec59cb/src/models/providerTypes.ts#L66) ## Methods diff --git a/docs/api-typedocs/modules/EthersContext.md b/docs/api-typedocs/modules/EthersContext.md index 9ea44f69..b825969a 100644 --- a/docs/api-typedocs/modules/EthersContext.md +++ b/docs/api-typedocs/modules/EthersContext.md @@ -67,7 +67,7 @@ current block number #### Defined in -[src/context/BlockNumberContext.tsx:62](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/context/BlockNumberContext.tsx#L62) +[src/context/BlockNumberContext.tsx:62](https://github.com/scaffold-eth/eth-hooks/blob/cec59cb/src/context/BlockNumberContext.tsx#L62) ___ @@ -77,7 +77,7 @@ ___ #### Summary This Hook provides you with access to the current Ethers Provider Context. -This provider would be the one selected by using {@link EthersModalConnector} and Web3Modal +This provider would be the one selected by using [EthersModalConnector](../classes/EthersContext.EthersModalConnector.md) and Web3Modal #### Features Gives you access to consistent interface to get the current provider information [EthersModalConnector](../classes/EthersContext.EthersModalConnector.md) @@ -101,7 +101,7 @@ Gives you access to consistent interface to get the current provider information #### Defined in -[src/context/EthersAppContext.tsx:75](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/context/EthersAppContext.tsx#L75) +[src/context/EthersAppContext.tsx:75](https://github.com/scaffold-eth/eth-hooks/blob/cec59cb/src/context/EthersAppContext.tsx#L75) ___ @@ -130,7 +130,7 @@ See scaffold-eth-typescript for an example that uses it to connect to a localhos #### Defined in -[src/context/connectors/StaticJsonRpcProviderConnector.ts:31](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/context/connectors/StaticJsonRpcProviderConnector.ts#L31) +[src/context/connectors/StaticJsonRpcProviderConnector.ts:31](https://github.com/scaffold-eth/eth-hooks/blob/cec59cb/src/context/connectors/StaticJsonRpcProviderConnector.ts#L31) ## EthersContext Variables @@ -147,7 +147,7 @@ A context that works with [useBlockNumberContext](EthersContext.md#useblocknumbe #### Defined in -[src/context/BlockNumberContext.tsx:84](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/context/BlockNumberContext.tsx#L84) +[src/context/BlockNumberContext.tsx:84](https://github.com/scaffold-eth/eth-hooks/blob/cec59cb/src/context/BlockNumberContext.tsx#L84) ___ @@ -165,7 +165,7 @@ This is a wrapper around Web3ReactProvider that provides additional functionalit #### Defined in -[src/context/EthersAppContext.tsx:168](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/context/EthersAppContext.tsx#L168) +[src/context/EthersAppContext.tsx:168](https://github.com/scaffold-eth/eth-hooks/blob/cec59cb/src/context/EthersAppContext.tsx#L168) ## EthersContext Type aliases @@ -191,7 +191,7 @@ A callback type that returns a EthersModalConnector #### Defined in -[src/context/EthersAppContext.tsx:23](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/context/EthersAppContext.tsx#L23) +[src/context/EthersAppContext.tsx:23](https://github.com/scaffold-eth/eth-hooks/blob/cec59cb/src/context/EthersAppContext.tsx#L23) ___ @@ -203,4 +203,4 @@ ___ #### Defined in -[src/context/connectors/EthersModalConnector.ts:45](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/context/connectors/EthersModalConnector.ts#L45) +[src/context/connectors/EthersModalConnector.ts:45](https://github.com/scaffold-eth/eth-hooks/blob/cec59cb/src/context/connectors/EthersModalConnector.ts#L45) diff --git a/docs/api-typedocs/modules/Helpers.md b/docs/api-typedocs/modules/Helpers.md index 91e1271d..aed34bc9 100644 --- a/docs/api-typedocs/modules/Helpers.md +++ b/docs/api-typedocs/modules/Helpers.md @@ -43,4 +43,4 @@ const ExampleUI = lazier(() => import('./exampleui/ExampleUI'), 'ExampleUI'); #### Defined in -[src/helpers/lazier.ts:18](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/helpers/lazier.ts#L18) +[src/helpers/lazier.ts:18](https://github.com/scaffold-eth/eth-hooks/blob/cec59cb/src/helpers/lazier.ts#L18) diff --git a/docs/api-typedocs/modules/Hooks.md b/docs/api-typedocs/modules/Hooks.md index 5b1cd71c..d198c309 100644 --- a/docs/api-typedocs/modules/Hooks.md +++ b/docs/api-typedocs/modules/Hooks.md @@ -67,7 +67,7 @@ price in USD #### Defined in -[src/hooks/dapps/useDexEthPrice.ts:22](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/hooks/dapps/useDexEthPrice.ts#L22) +[src/hooks/dapps/useDexEthPrice.ts:22](https://github.com/scaffold-eth/eth-hooks/blob/cec59cb/src/hooks/dapps/useDexEthPrice.ts#L22) ___ @@ -96,7 +96,7 @@ Gets a tokenlist from uniswap ipfs tokenlist #### Defined in -[src/hooks/dapps/useDexTokenList.ts:19](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/hooks/dapps/useDexTokenList.ts#L19) +[src/hooks/dapps/useDexTokenList.ts:19](https://github.com/scaffold-eth/eth-hooks/blob/cec59cb/src/hooks/dapps/useDexTokenList.ts#L19) ___ @@ -120,7 +120,7 @@ Gets the address from an ENS name #### Defined in -[src/hooks/dapps/useResolveEnsAddress.ts:16](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/hooks/dapps/useResolveEnsAddress.ts#L16) +[src/hooks/dapps/useResolveEnsAddress.ts:16](https://github.com/scaffold-eth/eth-hooks/blob/cec59cb/src/hooks/dapps/useResolveEnsAddress.ts#L16) ___ @@ -144,7 +144,7 @@ Gets ENS name for given address #### Defined in -[src/hooks/dapps/useResolveEnsName.ts:44](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/hooks/dapps/useResolveEnsName.ts#L44) +[src/hooks/dapps/useResolveEnsName.ts:44](https://github.com/scaffold-eth/eth-hooks/blob/cec59cb/src/hooks/dapps/useResolveEnsName.ts#L44) ___ @@ -173,7 +173,7 @@ Get the balance of an ERC20 token in an address #### Defined in -[src/hooks/erc/useTokenBalance.ts:39](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/hooks/erc/useTokenBalance.ts#L39) +[src/hooks/erc/useTokenBalance.ts:39](https://github.com/scaffold-eth/eth-hooks/blob/cec59cb/src/hooks/erc/useTokenBalance.ts#L39) ___ @@ -202,7 +202,7 @@ current balance #### Defined in -[src/hooks/useBalance.ts:21](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/hooks/useBalance.ts#L21) +[src/hooks/useBalance.ts:21](https://github.com/scaffold-eth/eth-hooks/blob/cec59cb/src/hooks/useBalance.ts#L21) ___ @@ -233,7 +233,7 @@ block number #### Defined in -[src/hooks/useBlockNumber.ts:22](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/hooks/useBlockNumber.ts#L22) +[src/hooks/useBlockNumber.ts:22](https://github.com/scaffold-eth/eth-hooks/blob/cec59cb/src/hooks/useBlockNumber.ts#L22) ___ @@ -259,7 +259,7 @@ IBurnerSigner #### Defined in -[src/hooks/useBurnerSigner.ts:87](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/hooks/useBurnerSigner.ts#L87) +[src/hooks/useBurnerSigner.ts:87](https://github.com/scaffold-eth/eth-hooks/blob/cec59cb/src/hooks/useBurnerSigner.ts#L87) ___ @@ -286,7 +286,7 @@ Checks whether a contract exists on the blockchain #### Defined in -[src/hooks/useContractExistsAtAddress.ts:19](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/hooks/useContractExistsAtAddress.ts#L19) +[src/hooks/useContractExistsAtAddress.ts:19](https://github.com/scaffold-eth/eth-hooks/blob/cec59cb/src/hooks/useContractExistsAtAddress.ts#L19) ___ @@ -323,7 +323,7 @@ Record of contractName:Contracts #### Defined in -[src/hooks/useContractLoader.ts:58](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/hooks/useContractLoader.ts#L58) +[src/hooks/useContractLoader.ts:58](https://github.com/scaffold-eth/eth-hooks/blob/cec59cb/src/hooks/useContractLoader.ts#L58) ___ @@ -361,7 +361,7 @@ Enables you to call a contract function with arguments and receive the output. #### Defined in -[src/hooks/useContractReader.ts:25](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/hooks/useContractReader.ts#L25) +[src/hooks/useContractReader.ts:25](https://github.com/scaffold-eth/eth-hooks/blob/cec59cb/src/hooks/useContractReader.ts#L25) ___ @@ -390,7 +390,7 @@ Tracks the events of associated with a contract #### Defined in -[src/hooks/useEventListener.ts:26](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/hooks/useEventListener.ts#L26) +[src/hooks/useEventListener.ts:26](https://github.com/scaffold-eth/eth-hooks/blob/cec59cb/src/hooks/useEventListener.ts#L26) ___ @@ -425,7 +425,7 @@ gas as gwei #### Defined in -[src/hooks/useGasPrice.ts:39](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/hooks/useGasPrice.ts#L39) +[src/hooks/useGasPrice.ts:39](https://github.com/scaffold-eth/eth-hooks/blob/cec59cb/src/hooks/useGasPrice.ts#L39) ___ @@ -452,7 +452,7 @@ Gets the user [TEthersUser](Models.md#tethersuser) from from the current provide #### Defined in -[src/hooks/useGetUserFromProviders.ts:21](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/hooks/useGetUserFromProviders.ts#L21) +[src/hooks/useGetUserFromProviders.ts:21](https://github.com/scaffold-eth/eth-hooks/blob/cec59cb/src/hooks/useGetUserFromProviders.ts#L21) ___ @@ -475,7 +475,7 @@ Gets the user [TEthersUser](Models.md#tethersuser) for a signer or wallet #### Defined in -[src/hooks/useGetUserFromSigners.ts:16](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/hooks/useGetUserFromSigners.ts#L16) +[src/hooks/useGetUserFromSigners.ts:16](https://github.com/scaffold-eth/eth-hooks/blob/cec59cb/src/hooks/useGetUserFromSigners.ts#L16) ___ @@ -502,7 +502,7 @@ Get the current nonce for the address provided #### Defined in -[src/hooks/useNonce.ts:19](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/hooks/useNonce.ts#L19) +[src/hooks/useNonce.ts:19](https://github.com/scaffold-eth/eth-hooks/blob/cec59cb/src/hooks/useNonce.ts#L19) ___ @@ -535,7 +535,7 @@ The callback can be invoked once on leading edge when leadTrigger conditions are #### Defined in -[src/hooks/useOnRepetition.ts:43](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/hooks/useOnRepetition.ts#L43) +[src/hooks/useOnRepetition.ts:43](https://github.com/scaffold-eth/eth-hooks/blob/cec59cb/src/hooks/useOnRepetition.ts#L43) ___ @@ -556,7 +556,7 @@ Get the current timestamp from the latest block #### Defined in -[src/hooks/useTimestamp.ts:19](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/hooks/useTimestamp.ts#L19) +[src/hooks/useTimestamp.ts:19](https://github.com/scaffold-eth/eth-hooks/blob/cec59cb/src/hooks/useTimestamp.ts#L19) ___ @@ -579,7 +579,7 @@ Get the address from the signer #### Defined in -[src/hooks/useUserAddress.ts:17](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/hooks/useUserAddress.ts#L17) +[src/hooks/useUserAddress.ts:17](https://github.com/scaffold-eth/eth-hooks/blob/cec59cb/src/hooks/useUserAddress.ts#L17) ___ @@ -607,7 +607,7 @@ A hook that makes it easy to interact and use [web3Modal](https://github.com/Web #### Defined in -[src/hooks/useWeb3Modal.ts:47](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/hooks/useWeb3Modal.ts#L47) +[src/hooks/useWeb3Modal.ts:47](https://github.com/scaffold-eth/eth-hooks/blob/cec59cb/src/hooks/useWeb3Modal.ts#L47) ___ @@ -630,7 +630,7 @@ ___ #### Defined in -[src/hooks/useContractLoader.ts:14](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/hooks/useContractLoader.ts#L14) +[src/hooks/useContractLoader.ts:14](https://github.com/scaffold-eth/eth-hooks/blob/cec59cb/src/hooks/useContractLoader.ts#L14) ## Hooks Type aliases @@ -659,7 +659,7 @@ Return type of useBurnerSigner: #### Defined in -[src/hooks/useBurnerSigner.ts:56](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/hooks/useBurnerSigner.ts#L56) +[src/hooks/useBurnerSigner.ts:56](https://github.com/scaffold-eth/eth-hooks/blob/cec59cb/src/hooks/useBurnerSigner.ts#L56) ___ @@ -675,7 +675,7 @@ Preset speeds for Eth Gas Station API #### Defined in -[src/hooks/useGasPrice.ts:19](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/hooks/useGasPrice.ts#L19) +[src/hooks/useGasPrice.ts:19](https://github.com/scaffold-eth/eth-hooks/blob/cec59cb/src/hooks/useGasPrice.ts#L19) ___ @@ -696,4 +696,4 @@ The current state of Web3Modal #### Defined in -[src/hooks/useWeb3Modal.ts:15](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/hooks/useWeb3Modal.ts#L15) +[src/hooks/useWeb3Modal.ts:15](https://github.com/scaffold-eth/eth-hooks/blob/cec59cb/src/hooks/useWeb3Modal.ts#L15) diff --git a/docs/api-typedocs/modules/Models.md b/docs/api-typedocs/modules/Models.md index b2eed204..54e29df9 100644 --- a/docs/api-typedocs/modules/Models.md +++ b/docs/api-typedocs/modules/Models.md @@ -49,7 +49,7 @@ Contracts deployed by hardhat #### Defined in -[src/models/contractTypes.ts:29](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/models/contractTypes.ts#L29) +[src/models/contractTypes.ts:29](https://github.com/scaffold-eth/eth-hooks/blob/cec59cb/src/models/contractTypes.ts#L29) ___ @@ -71,7 +71,7 @@ Contract factories for contracts deployed by hardhat #### Defined in -[src/models/contractTypes.ts:47](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/models/contractTypes.ts#L47) +[src/models/contractTypes.ts:47](https://github.com/scaffold-eth/eth-hooks/blob/cec59cb/src/models/contractTypes.ts#L47) ___ @@ -90,7 +90,7 @@ A type for external contracts #### Defined in -[src/models/contractTypes.ts:62](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/models/contractTypes.ts#L62) +[src/models/contractTypes.ts:62](https://github.com/scaffold-eth/eth-hooks/blob/cec59cb/src/models/contractTypes.ts#L62) ___ @@ -114,7 +114,7 @@ Contract function information: #### Defined in -[src/models/contractTypes.ts:79](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/models/contractTypes.ts#L79) +[src/models/contractTypes.ts:79](https://github.com/scaffold-eth/eth-hooks/blob/cec59cb/src/models/contractTypes.ts#L79) ___ @@ -137,7 +137,7 @@ Configuration for useContractLoader #### Defined in -[src/models/contractTypes.ts:91](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/models/contractTypes.ts#L91) +[src/models/contractTypes.ts:91](https://github.com/scaffold-eth/eth-hooks/blob/cec59cb/src/models/contractTypes.ts#L91) ___ @@ -163,7 +163,7 @@ A type that describes a network for applications #### Defined in -[src/models/networkTypes.ts:7](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/models/networkTypes.ts#L7) +[src/models/networkTypes.ts:7](https://github.com/scaffold-eth/eth-hooks/blob/cec59cb/src/models/networkTypes.ts#L7) ___ @@ -185,7 +185,7 @@ describes the sctructure of a contract in hardhat_contracts.json #### Defined in -[src/models/contractTypes.ts:16](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/models/contractTypes.ts#L16) +[src/models/contractTypes.ts:16](https://github.com/scaffold-eth/eth-hooks/blob/cec59cb/src/models/contractTypes.ts#L16) ___ @@ -203,7 +203,7 @@ Used by eth-hooks, eth-components and scaffold-eth-typescript #### Defined in -[src/models/providerTypes.ts:19](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/models/providerTypes.ts#L19) +[src/models/providerTypes.ts:19](https://github.com/scaffold-eth/eth-hooks/blob/cec59cb/src/models/providerTypes.ts#L19) ___ @@ -216,7 +216,7 @@ A union of various providers and signers in ethers to give maximum flexibility #### Defined in -[src/models/providerTypes.ts:27](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/models/providerTypes.ts#L27) +[src/models/providerTypes.ts:27](https://github.com/scaffold-eth/eth-hooks/blob/cec59cb/src/models/providerTypes.ts#L27) ___ @@ -229,7 +229,7 @@ A union of various providers in ethers to give maximum flexibility #### Defined in -[src/models/providerTypes.ts:42](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/models/providerTypes.ts#L42) +[src/models/providerTypes.ts:42](https://github.com/scaffold-eth/eth-hooks/blob/cec59cb/src/models/providerTypes.ts#L42) ___ @@ -242,7 +242,7 @@ A union of abstract, non initalizable providers, used by some functions #### Defined in -[src/models/providerTypes.ts:50](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/models/providerTypes.ts#L50) +[src/models/providerTypes.ts:50](https://github.com/scaffold-eth/eth-hooks/blob/cec59cb/src/models/providerTypes.ts#L50) ___ @@ -264,4 +264,4 @@ Essentially a provider and signer and network information for ease of use. #### Defined in -[src/models/providerTypes.ts:58](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/models/providerTypes.ts#L58) +[src/models/providerTypes.ts:58](https://github.com/scaffold-eth/eth-hooks/blob/cec59cb/src/models/providerTypes.ts#L58) diff --git a/docs/api-typedocs/modules/TestUtils.md b/docs/api-typedocs/modules/TestUtils.md index 5b946f0b..8b34bef0 100644 --- a/docs/api-typedocs/modules/TestUtils.md +++ b/docs/api-typedocs/modules/TestUtils.md @@ -36,7 +36,7 @@ Utilities to write tests with ethers, waffle and react hooks #### Defined in -[src/helpers/test-utils/constants/testConstants.ts:3](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/helpers/test-utils/constants/testConstants.ts#L3) +[src/helpers/test-utils/constants/testConstants.ts:3](https://github.com/scaffold-eth/eth-hooks/blob/cec59cb/src/helpers/test-utils/constants/testConstants.ts#L3) ___ @@ -46,7 +46,7 @@ ___ #### Defined in -[src/helpers/test-utils/constants/testConstants.ts:5](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/helpers/test-utils/constants/testConstants.ts#L5) +[src/helpers/test-utils/constants/testConstants.ts:5](https://github.com/scaffold-eth/eth-hooks/blob/cec59cb/src/helpers/test-utils/constants/testConstants.ts#L5) ___ @@ -56,7 +56,7 @@ ___ #### Defined in -[src/helpers/test-utils/constants/testConstants.ts:7](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/helpers/test-utils/constants/testConstants.ts#L7) +[src/helpers/test-utils/constants/testConstants.ts:7](https://github.com/scaffold-eth/eth-hooks/blob/cec59cb/src/helpers/test-utils/constants/testConstants.ts#L7) ## Functions @@ -76,7 +76,7 @@ ___ #### Defined in -[src/helpers/test-utils/eth/hardhatActions.ts:3](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/helpers/test-utils/eth/hardhatActions.ts#L3) +[src/helpers/test-utils/eth/hardhatActions.ts:3](https://github.com/scaffold-eth/eth-hooks/blob/cec59cb/src/helpers/test-utils/eth/hardhatActions.ts#L3) ___ @@ -96,7 +96,7 @@ ___ #### Defined in -[src/helpers/test-utils/functions/conversions.ts:3](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/helpers/test-utils/functions/conversions.ts#L3) +[src/helpers/test-utils/functions/conversions.ts:3](https://github.com/scaffold-eth/eth-hooks/blob/cec59cb/src/helpers/test-utils/functions/conversions.ts#L3) ___ @@ -116,7 +116,7 @@ ___ #### Defined in -[src/helpers/test-utils/functions/conversions.ts:7](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/helpers/test-utils/functions/conversions.ts#L7) +[src/helpers/test-utils/functions/conversions.ts:7](https://github.com/scaffold-eth/eth-hooks/blob/cec59cb/src/helpers/test-utils/functions/conversions.ts#L7) ___ @@ -130,7 +130,7 @@ ___ #### Defined in -[src/helpers/test-utils/harness/getMockProvider.ts:6](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/helpers/test-utils/harness/getMockProvider.ts#L6) +[src/helpers/test-utils/harness/getMockProvider.ts:6](https://github.com/scaffold-eth/eth-hooks/blob/cec59cb/src/helpers/test-utils/harness/getMockProvider.ts#L6) ___ @@ -163,7 +163,7 @@ Created a test hook with a Web3Wrapper #### Defined in -[src/helpers/test-utils/harness/hookTestHarness.tsx:24](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/helpers/test-utils/harness/hookTestHarness.tsx#L24) +[src/helpers/test-utils/harness/hookTestHarness.tsx:24](https://github.com/scaffold-eth/eth-hooks/blob/cec59cb/src/helpers/test-utils/harness/hookTestHarness.tsx#L24) ___ @@ -183,7 +183,7 @@ ___ #### Defined in -[src/helpers/test-utils/harness/mockHelpers.ts:6](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/helpers/test-utils/harness/mockHelpers.ts#L6) +[src/helpers/test-utils/harness/mockHelpers.ts:6](https://github.com/scaffold-eth/eth-hooks/blob/cec59cb/src/helpers/test-utils/harness/mockHelpers.ts#L6) ___ @@ -203,7 +203,7 @@ ___ #### Defined in -[src/helpers/test-utils/harness/mockHelpers.ts:15](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/helpers/test-utils/harness/mockHelpers.ts#L15) +[src/helpers/test-utils/harness/mockHelpers.ts:15](https://github.com/scaffold-eth/eth-hooks/blob/cec59cb/src/helpers/test-utils/harness/mockHelpers.ts#L15) ___ @@ -224,7 +224,7 @@ ___ #### Defined in -[src/helpers/test-utils/harness/mockHelpers.ts:26](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/helpers/test-utils/harness/mockHelpers.ts#L26) +[src/helpers/test-utils/harness/mockHelpers.ts:26](https://github.com/scaffold-eth/eth-hooks/blob/cec59cb/src/helpers/test-utils/harness/mockHelpers.ts#L26) ___ @@ -245,7 +245,7 @@ ___ #### Defined in -[src/helpers/test-utils/harness/mockHelpers.ts:36](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/helpers/test-utils/harness/mockHelpers.ts#L36) +[src/helpers/test-utils/harness/mockHelpers.ts:36](https://github.com/scaffold-eth/eth-hooks/blob/cec59cb/src/helpers/test-utils/harness/mockHelpers.ts#L36) ## Type aliases @@ -262,4 +262,4 @@ ___ #### Defined in -[src/helpers/test-utils/harness/hookTestHarness.tsx:12](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/helpers/test-utils/harness/hookTestHarness.tsx#L12) +[src/helpers/test-utils/harness/hookTestHarness.tsx:12](https://github.com/scaffold-eth/eth-hooks/blob/cec59cb/src/helpers/test-utils/harness/hookTestHarness.tsx#L12) diff --git a/package.json b/package.json index 356374d2..49c0f3c7 100644 --- a/package.json +++ b/package.json @@ -71,7 +71,6 @@ }, "devDependencies": { "@atixlabs/hardhat-time-n-mine": "^0.0.5", - "lint-staged": "^11.2.6", "@nomiclabs/hardhat-ethers": "npm:hardhat-deploy-ethers@^0.3.0-beta.10", "@nomiclabs/hardhat-waffle": "^2.0.1", "@testing-library/dom": "^8.9.1", @@ -115,6 +114,7 @@ "hardhat-gas-reporter": "^1.0.4", "husky": "^7.0.0", "jsdom": "^18.0.0", + "lint-staged": "^11.2.6", "mocha": "^9.1.3", "mocha-github-actions-reporter": "^0.2.4", "mocha-junit-reporter": "^2.0.2", From 7a28cdc26d87ba63149ae2d2cc5450091c66efcc Mon Sep 17 00:00:00 2001 From: Shravan Sunder Date: Wed, 12 Jan 2022 20:20:01 -0500 Subject: [PATCH 02/21] #124 updated docs --- docs/api-typedocs/api-overview.md | 4 +- .../EthersContext.CouldNotActivateError.md | 10 +- .../EthersContext.EthersModalConnector.md | 117 +- ...ersContext.NoEthereumProviderFoundError.md | 10 +- .../EthersContext.UserClosedModalError.md | 10 +- .../classes/TestUtils.MockConnector.md | 1515 +++++++++++++++++ .../EthersContext.ICommonModalConnector.md | 28 +- ....IStaticJsonRpcProviderConnectorOptions.md | 6 +- .../Models.IContractFactoryBridge.md | 34 - ...ersContext.md => Models.IEthersContext.md} | 60 +- .../interfaces/Models.TypedEvent.md | 322 ---- docs/api-typedocs/modules/EthersContext.md | 308 +++- docs/api-typedocs/modules/Helpers.md | 6 +- docs/api-typedocs/modules/Hooks.md | 422 ++--- docs/api-typedocs/modules/Models.md | 579 +++++-- docs/api-typedocs/modules/TestUtils.md | 128 +- package.json | 1 + src/dapps.ts | 4 + src/erc.ts | 4 + src/functions/hookOptionsHelpers.ts | 2 +- src/helpers/typedoc/hooks.docs.ts | 3 +- src/hooks/useEventListener.ts | 4 +- src/hooks/useSignerChainId.ts | 4 +- src/models/hookOptions.ts | 79 +- src/models/networkTypes.ts | 2 +- src/models/providerTypes.ts | 26 +- src/models/utilityTypes.ts | 6 + typedoc.json | 2 +- 28 files changed, 2865 insertions(+), 831 deletions(-) create mode 100644 docs/api-typedocs/classes/TestUtils.MockConnector.md delete mode 100644 docs/api-typedocs/interfaces/Models.IContractFactoryBridge.md rename docs/api-typedocs/interfaces/{EthersContext.IEthersContext.md => Models.IEthersContext.md} (55%) delete mode 100644 docs/api-typedocs/interfaces/Models.TypedEvent.md diff --git a/docs/api-typedocs/api-overview.md b/docs/api-typedocs/api-overview.md index 5c10e232..43a5fcd8 100644 --- a/docs/api-typedocs/api-overview.md +++ b/docs/api-typedocs/api-overview.md @@ -1,6 +1,6 @@ -eth-hooks - v3.4.0 +eth-hooks - v4.0.8 -# eth-hooks - v3.4.0 +# eth-hooks - v4.0.8 ## Table of contents diff --git a/docs/api-typedocs/classes/EthersContext.CouldNotActivateError.md b/docs/api-typedocs/classes/EthersContext.CouldNotActivateError.md index c46220df..e056bc47 100644 --- a/docs/api-typedocs/classes/EthersContext.CouldNotActivateError.md +++ b/docs/api-typedocs/classes/EthersContext.CouldNotActivateError.md @@ -1,4 +1,4 @@ -[eth-hooks - v3.4.0](../README.md) / [EthersContext](../modules/EthersContext.md) / CouldNotActivateError +[eth-hooks - v4.0.8](../README.md) / [EthersContext](../modules/EthersContext.md) / CouldNotActivateError # Class: CouldNotActivateError @@ -114,7 +114,7 @@ Error.name #### Defined in -node_modules/typescript/lib/lib.es5.d.ts:973 +node_modules/typescript/lib/lib.es5.d.ts:1022 ___ @@ -128,7 +128,7 @@ Error.message #### Defined in -node_modules/typescript/lib/lib.es5.d.ts:974 +node_modules/typescript/lib/lib.es5.d.ts:1023 ___ @@ -142,7 +142,7 @@ Error.stack #### Defined in -node_modules/typescript/lib/lib.es5.d.ts:975 +node_modules/typescript/lib/lib.es5.d.ts:1024 ## Constructors @@ -162,4 +162,4 @@ Error.constructor #### Defined in -[src/context/connectors/connectorErrors.ts:16](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/context/connectors/connectorErrors.ts#L16) +[src/context/ethers/connectors/connectorErrors.ts:16](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/context/ethers/connectors/connectorErrors.ts#L16) diff --git a/docs/api-typedocs/classes/EthersContext.EthersModalConnector.md b/docs/api-typedocs/classes/EthersContext.EthersModalConnector.md index 938f5837..aa51087f 100644 --- a/docs/api-typedocs/classes/EthersContext.EthersModalConnector.md +++ b/docs/api-typedocs/classes/EthersContext.EthersModalConnector.md @@ -1,4 +1,4 @@ -[eth-hooks - v3.4.0](../README.md) / [EthersContext](../modules/EthersContext.md) / EthersModalConnector +[eth-hooks - v4.0.8](../README.md) / [EthersContext](../modules/EthersContext.md) / EthersModalConnector # Class: EthersModalConnector @@ -9,7 +9,7 @@ This is a connector for [web3-react](https://github.com/NoahZinsmeister/web3-rea The provider selected by user via web3modal is interfaced to the web3-react context. #### Features -- This connector used with [useEthersContext](../modules/EthersContext.md#useetherscontext) allows the app and all the hooks to effortlessly access the current network, provider, signer, address information [IEthersContext](../interfaces/EthersContext.IEthersContext.md) +- This connector used with [useEthersContext](../modules/EthersContext.md#useetherscontext) allows the app and all the hooks to effortlessly access the current network, provider, signer, address information [IEthersContext](../interfaces/Models.IEthersContext.md) - The connector centralizes and takes care of management of the web3 interaction and provides a consistent exprience for your app. #### Notes @@ -51,13 +51,16 @@ The provider selected by user via web3modal is interfaced to the web3-react cont - [emitUpdate](EthersContext.EthersModalConnector.md#emitupdate) - [emitError](EthersContext.EthersModalConnector.md#emiterror) - [emitDeactivate](EthersContext.EthersModalConnector.md#emitdeactivate) +- [hasCachedProvider](EthersContext.EthersModalConnector.md#hascachedprovider) - [log](EthersContext.EthersModalConnector.md#log) +- [loadCore](EthersContext.EthersModalConnector.md#loadcore) - [activate](EthersContext.EthersModalConnector.md#activate) - [deactivate](EthersContext.EthersModalConnector.md#deactivate) - [getProvider](EthersContext.EthersModalConnector.md#getprovider) - [getChainId](EthersContext.EthersModalConnector.md#getchainid) - [getAccount](EthersContext.EthersModalConnector.md#getaccount) - [getSigner](EthersContext.EthersModalConnector.md#getsigner) +- [getSignerFromAccount](EthersContext.EthersModalConnector.md#getsignerfromaccount) - [changeSigner](EthersContext.EthersModalConnector.md#changesigner) - [validState](EthersContext.EthersModalConnector.md#validstate) - [resetModal](EthersContext.EthersModalConnector.md#resetmodal) @@ -379,7 +382,7 @@ const { getEventListeners, EventEmitter } = require('events'); | Name | Type | | :------ | :------ | -| `emitter` | `EventEmitter` \| `DOMEventTarget` | +| `emitter` | `DOMEventTarget` \| `EventEmitter` | | `name` | `string` \| `symbol` | #### Returns @@ -1068,7 +1071,7 @@ AbstractConnector.emitUpdate #### Defined in -node_modules/@web3-react/abstract-connector/dist/index.d.ts:12 +node_modules/@web3-react/core/node_modules/@web3-react/abstract-connector/dist/index.d.ts:12 ___ @@ -1092,7 +1095,7 @@ AbstractConnector.emitError #### Defined in -node_modules/@web3-react/abstract-connector/dist/index.d.ts:13 +node_modules/@web3-react/core/node_modules/@web3-react/abstract-connector/dist/index.d.ts:13 ___ @@ -1110,7 +1113,25 @@ AbstractConnector.emitDeactivate #### Defined in -node_modules/@web3-react/abstract-connector/dist/index.d.ts:14 +node_modules/@web3-react/core/node_modules/@web3-react/abstract-connector/dist/index.d.ts:14 + +___ + +### hasCachedProvider + +▸ **hasCachedProvider**(): `boolean` + +#### Returns + +`boolean` + +#### Implementation of + +[ICommonModalConnector](../interfaces/EthersContext.ICommonModalConnector.md).[hasCachedProvider](../interfaces/EthersContext.ICommonModalConnector.md#hascachedprovider) + +#### Defined in + +[src/context/ethers/connectors/EthersModalConnector.ts:76](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/context/ethers/connectors/EthersModalConnector.ts#L76) ___ @@ -1130,7 +1151,21 @@ ___ #### Defined in -[src/context/connectors/EthersModalConnector.ts:102](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/context/connectors/EthersModalConnector.ts#L102) +[src/context/ethers/connectors/EthersModalConnector.ts:106](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/context/ethers/connectors/EthersModalConnector.ts#L106) + +___ + +### loadCore + +▸ **loadCore**(): `void` + +#### Returns + +`void` + +#### Defined in + +[src/context/ethers/connectors/EthersModalConnector.ts:154](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/context/ethers/connectors/EthersModalConnector.ts#L154) ___ @@ -1161,7 +1196,7 @@ AbstractConnector.activate #### Defined in -[src/context/connectors/EthersModalConnector.ts:170](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/context/connectors/EthersModalConnector.ts#L170) +[src/context/ethers/connectors/EthersModalConnector.ts:175](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/context/ethers/connectors/EthersModalConnector.ts#L175) ___ @@ -1182,7 +1217,7 @@ AbstractConnector.deactivate #### Defined in -[src/context/connectors/EthersModalConnector.ts:228](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/context/connectors/EthersModalConnector.ts#L228) +[src/context/ethers/connectors/EthersModalConnector.ts:233](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/context/ethers/connectors/EthersModalConnector.ts#L233) ___ @@ -1200,7 +1235,7 @@ AbstractConnector.getProvider #### Defined in -[src/context/connectors/EthersModalConnector.ts:248](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/context/connectors/EthersModalConnector.ts#L248) +[src/context/ethers/connectors/EthersModalConnector.ts:253](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/context/ethers/connectors/EthersModalConnector.ts#L253) ___ @@ -1218,7 +1253,7 @@ AbstractConnector.getChainId #### Defined in -[src/context/connectors/EthersModalConnector.ts:252](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/context/connectors/EthersModalConnector.ts#L252) +[src/context/ethers/connectors/EthersModalConnector.ts:257](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/context/ethers/connectors/EthersModalConnector.ts#L257) ___ @@ -1236,7 +1271,7 @@ AbstractConnector.getAccount #### Defined in -[src/context/connectors/EthersModalConnector.ts:262](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/context/connectors/EthersModalConnector.ts#L262) +[src/context/ethers/connectors/EthersModalConnector.ts:267](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/context/ethers/connectors/EthersModalConnector.ts#L267) ___ @@ -1254,7 +1289,21 @@ ___ #### Defined in -[src/context/connectors/EthersModalConnector.ts:274](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/context/connectors/EthersModalConnector.ts#L274) +[src/context/ethers/connectors/EthersModalConnector.ts:279](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/context/ethers/connectors/EthersModalConnector.ts#L279) + +___ + +### getSignerFromAccount + +▸ **getSignerFromAccount**(): `Promise`<`void`\> + +#### Returns + +`Promise`<`void`\> + +#### Defined in + +[src/context/ethers/connectors/EthersModalConnector.ts:283](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/context/ethers/connectors/EthersModalConnector.ts#L283) ___ @@ -1281,7 +1330,7 @@ Change the current signer and account used by the connector #### Defined in -[src/context/connectors/EthersModalConnector.ts:283](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/context/connectors/EthersModalConnector.ts#L283) +[src/context/ethers/connectors/EthersModalConnector.ts:294](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/context/ethers/connectors/EthersModalConnector.ts#L294) ___ @@ -1295,7 +1344,7 @@ ___ #### Defined in -[src/context/connectors/EthersModalConnector.ts:294](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/context/connectors/EthersModalConnector.ts#L294) +[src/context/ethers/connectors/EthersModalConnector.ts:305](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/context/ethers/connectors/EthersModalConnector.ts#L305) ___ @@ -1316,7 +1365,7 @@ Resets the web3Modal and clears the cache #### Defined in -[src/context/connectors/EthersModalConnector.ts:302](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/context/connectors/EthersModalConnector.ts#L302) +[src/context/ethers/connectors/EthersModalConnector.ts:313](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/context/ethers/connectors/EthersModalConnector.ts#L313) ___ @@ -1331,7 +1380,7 @@ Sets the web3modal theme: light | dark | ThemeColors | Name | Type | | :------ | :------ | -| `theme` | `ThemeColors` \| `TWeb3ModalTheme` | +| `theme` | `TWeb3ModalTheme` \| `ThemeColors` | #### Returns @@ -1343,7 +1392,7 @@ Sets the web3modal theme: light | dark | ThemeColors #### Defined in -[src/context/connectors/EthersModalConnector.ts:317](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/context/connectors/EthersModalConnector.ts#L317) +[src/context/ethers/connectors/EthersModalConnector.ts:328](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/context/ethers/connectors/EthersModalConnector.ts#L328) ## Properties @@ -1423,7 +1472,7 @@ AbstractConnector.supportedChainIds #### Defined in -node_modules/@web3-react/abstract-connector/dist/index.d.ts:5 +node_modules/@web3-react/core/node_modules/@web3-react/abstract-connector/dist/index.d.ts:5 ___ @@ -1433,7 +1482,7 @@ ___ #### Defined in -[src/context/connectors/EthersModalConnector.ts:62](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/context/connectors/EthersModalConnector.ts#L62) +[src/context/ethers/connectors/EthersModalConnector.ts:62](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/context/ethers/connectors/EthersModalConnector.ts#L62) ___ @@ -1443,7 +1492,7 @@ ___ #### Defined in -[src/context/connectors/EthersModalConnector.ts:63](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/context/connectors/EthersModalConnector.ts#L63) +[src/context/ethers/connectors/EthersModalConnector.ts:63](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/context/ethers/connectors/EthersModalConnector.ts#L63) ___ @@ -1453,7 +1502,7 @@ ___ #### Defined in -[src/context/connectors/EthersModalConnector.ts:64](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/context/connectors/EthersModalConnector.ts#L64) +[src/context/ethers/connectors/EthersModalConnector.ts:64](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/context/ethers/connectors/EthersModalConnector.ts#L64) ___ @@ -1463,7 +1512,7 @@ ___ #### Defined in -[src/context/connectors/EthersModalConnector.ts:65](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/context/connectors/EthersModalConnector.ts#L65) +[src/context/ethers/connectors/EthersModalConnector.ts:65](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/context/ethers/connectors/EthersModalConnector.ts#L65) ___ @@ -1473,7 +1522,7 @@ ___ #### Defined in -[src/context/connectors/EthersModalConnector.ts:66](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/context/connectors/EthersModalConnector.ts#L66) +[src/context/ethers/connectors/EthersModalConnector.ts:66](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/context/ethers/connectors/EthersModalConnector.ts#L66) ___ @@ -1483,17 +1532,17 @@ ___ #### Defined in -[src/context/connectors/EthersModalConnector.ts:67](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/context/connectors/EthersModalConnector.ts#L67) +[src/context/ethers/connectors/EthersModalConnector.ts:67](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/context/ethers/connectors/EthersModalConnector.ts#L67) ___ ### \_config -• `Protected` **\_config**: `TEthersModalConfig` +• `Protected` **\_config**: `Readonly`<`TEthersModalConfig`\> #### Defined in -[src/context/connectors/EthersModalConnector.ts:68](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/context/connectors/EthersModalConnector.ts#L68) +[src/context/ethers/connectors/EthersModalConnector.ts:68](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/context/ethers/connectors/EthersModalConnector.ts#L68) ___ @@ -1503,17 +1552,17 @@ ___ #### Defined in -[src/context/connectors/EthersModalConnector.ts:69](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/context/connectors/EthersModalConnector.ts#L69) +[src/context/ethers/connectors/EthersModalConnector.ts:69](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/context/ethers/connectors/EthersModalConnector.ts#L69) ___ ### \_theme -• `Protected` **\_theme**: `ThemeColors` \| `TWeb3ModalTheme` +• `Protected` **\_theme**: `TWeb3ModalTheme` \| `ThemeColors` #### Defined in -[src/context/connectors/EthersModalConnector.ts:70](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/context/connectors/EthersModalConnector.ts#L70) +[src/context/ethers/connectors/EthersModalConnector.ts:70](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/context/ethers/connectors/EthersModalConnector.ts#L70) ## Constructors @@ -1536,18 +1585,18 @@ AbstractConnector.constructor #### Defined in -[src/context/connectors/EthersModalConnector.ts:82](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/context/connectors/EthersModalConnector.ts#L82) +[src/context/ethers/connectors/EthersModalConnector.ts:86](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/context/ethers/connectors/EthersModalConnector.ts#L86) ## Accessors ### config -• `get` **config**(): `TEthersModalConfig` +• `get` **config**(): `Readonly`<`TEthersModalConfig`\> #### Returns -`TEthersModalConfig` +`Readonly`<`TEthersModalConfig`\> #### Defined in -[src/context/connectors/EthersModalConnector.ts:72](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/context/connectors/EthersModalConnector.ts#L72) +[src/context/ethers/connectors/EthersModalConnector.ts:72](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/context/ethers/connectors/EthersModalConnector.ts#L72) diff --git a/docs/api-typedocs/classes/EthersContext.NoEthereumProviderFoundError.md b/docs/api-typedocs/classes/EthersContext.NoEthereumProviderFoundError.md index ec16909f..318c12d1 100644 --- a/docs/api-typedocs/classes/EthersContext.NoEthereumProviderFoundError.md +++ b/docs/api-typedocs/classes/EthersContext.NoEthereumProviderFoundError.md @@ -1,4 +1,4 @@ -[eth-hooks - v3.4.0](../README.md) / [EthersContext](../modules/EthersContext.md) / NoEthereumProviderFoundError +[eth-hooks - v4.0.8](../README.md) / [EthersContext](../modules/EthersContext.md) / NoEthereumProviderFoundError # Class: NoEthereumProviderFoundError @@ -114,7 +114,7 @@ Error.name #### Defined in -node_modules/typescript/lib/lib.es5.d.ts:973 +node_modules/typescript/lib/lib.es5.d.ts:1022 ___ @@ -128,7 +128,7 @@ Error.message #### Defined in -node_modules/typescript/lib/lib.es5.d.ts:974 +node_modules/typescript/lib/lib.es5.d.ts:1023 ___ @@ -142,7 +142,7 @@ Error.stack #### Defined in -node_modules/typescript/lib/lib.es5.d.ts:975 +node_modules/typescript/lib/lib.es5.d.ts:1024 ## Constructors @@ -156,4 +156,4 @@ Error.constructor #### Defined in -[src/context/connectors/connectorErrors.ts:27](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/context/connectors/connectorErrors.ts#L27) +[src/context/ethers/connectors/connectorErrors.ts:27](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/context/ethers/connectors/connectorErrors.ts#L27) diff --git a/docs/api-typedocs/classes/EthersContext.UserClosedModalError.md b/docs/api-typedocs/classes/EthersContext.UserClosedModalError.md index 7b2aa73b..b538ea1f 100644 --- a/docs/api-typedocs/classes/EthersContext.UserClosedModalError.md +++ b/docs/api-typedocs/classes/EthersContext.UserClosedModalError.md @@ -1,4 +1,4 @@ -[eth-hooks - v3.4.0](../README.md) / [EthersContext](../modules/EthersContext.md) / UserClosedModalError +[eth-hooks - v4.0.8](../README.md) / [EthersContext](../modules/EthersContext.md) / UserClosedModalError # Class: UserClosedModalError @@ -114,7 +114,7 @@ Error.name #### Defined in -node_modules/typescript/lib/lib.es5.d.ts:973 +node_modules/typescript/lib/lib.es5.d.ts:1022 ___ @@ -128,7 +128,7 @@ Error.message #### Defined in -node_modules/typescript/lib/lib.es5.d.ts:974 +node_modules/typescript/lib/lib.es5.d.ts:1023 ___ @@ -142,7 +142,7 @@ Error.stack #### Defined in -node_modules/typescript/lib/lib.es5.d.ts:975 +node_modules/typescript/lib/lib.es5.d.ts:1024 ## Constructors @@ -156,4 +156,4 @@ Error.constructor #### Defined in -[src/context/connectors/connectorErrors.ts:5](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/context/connectors/connectorErrors.ts#L5) +[src/context/ethers/connectors/connectorErrors.ts:5](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/context/ethers/connectors/connectorErrors.ts#L5) diff --git a/docs/api-typedocs/classes/TestUtils.MockConnector.md b/docs/api-typedocs/classes/TestUtils.MockConnector.md new file mode 100644 index 00000000..1e86fb29 --- /dev/null +++ b/docs/api-typedocs/classes/TestUtils.MockConnector.md @@ -0,0 +1,1515 @@ +[eth-hooks - v4.0.8](../README.md) / [TestUtils](../modules/TestUtils.md) / MockConnector + +# Class: MockConnector + +[TestUtils](../modules/TestUtils.md).MockConnector + +## Hierarchy + +- `AbstractConnector` + + ↳ **`MockConnector`** + +## Implements + +- [`ICommonModalConnector`](../interfaces/EthersContext.ICommonModalConnector.md) + +## Table of contents + +### Methods + +- [once](TestUtils.MockConnector.md#once) +- [on](TestUtils.MockConnector.md#on) +- [listenerCount](TestUtils.MockConnector.md#listenercount) +- [getEventListeners](TestUtils.MockConnector.md#geteventlisteners) +- [addListener](TestUtils.MockConnector.md#addlistener) +- [on](TestUtils.MockConnector.md#on) +- [once](TestUtils.MockConnector.md#once) +- [removeListener](TestUtils.MockConnector.md#removelistener) +- [off](TestUtils.MockConnector.md#off) +- [removeAllListeners](TestUtils.MockConnector.md#removealllisteners) +- [setMaxListeners](TestUtils.MockConnector.md#setmaxlisteners) +- [getMaxListeners](TestUtils.MockConnector.md#getmaxlisteners) +- [listeners](TestUtils.MockConnector.md#listeners) +- [rawListeners](TestUtils.MockConnector.md#rawlisteners) +- [emit](TestUtils.MockConnector.md#emit) +- [listenerCount](TestUtils.MockConnector.md#listenercount) +- [prependListener](TestUtils.MockConnector.md#prependlistener) +- [prependOnceListener](TestUtils.MockConnector.md#prependoncelistener) +- [eventNames](TestUtils.MockConnector.md#eventnames) +- [emitUpdate](TestUtils.MockConnector.md#emitupdate) +- [emitError](TestUtils.MockConnector.md#emiterror) +- [emitDeactivate](TestUtils.MockConnector.md#emitdeactivate) +- [replaceWithSpies](TestUtils.MockConnector.md#replacewithspies) +- [hasCachedProvider](TestUtils.MockConnector.md#hascachedprovider) +- [getSigner](TestUtils.MockConnector.md#getsigner) +- [setModalTheme](TestUtils.MockConnector.md#setmodaltheme) +- [resetModal](TestUtils.MockConnector.md#resetmodal) +- [changeSigner](TestUtils.MockConnector.md#changesigner) +- [activate](TestUtils.MockConnector.md#activate) +- [getProvider](TestUtils.MockConnector.md#getprovider) +- [getChainId](TestUtils.MockConnector.md#getchainid) +- [getAccount](TestUtils.MockConnector.md#getaccount) +- [setMockAccount](TestUtils.MockConnector.md#setmockaccount) +- [deactivate](TestUtils.MockConnector.md#deactivate) + +### Properties + +- [errorMonitor](TestUtils.MockConnector.md#errormonitor) +- [captureRejectionSymbol](TestUtils.MockConnector.md#capturerejectionsymbol) +- [captureRejections](TestUtils.MockConnector.md#capturerejections) +- [defaultMaxListeners](TestUtils.MockConnector.md#defaultmaxlisteners) +- [supportedChainIds](TestUtils.MockConnector.md#supportedchainids) +- [provider](TestUtils.MockConnector.md#provider) +- [mockChainId](TestUtils.MockConnector.md#mockchainid) +- [mockSigner](TestUtils.MockConnector.md#mocksigner) +- [mockAccount](TestUtils.MockConnector.md#mockaccount) +- [spyResetModal](TestUtils.MockConnector.md#spyresetmodal) +- [spySetModalTheme](TestUtils.MockConnector.md#spysetmodaltheme) +- [spyChangeSigner](TestUtils.MockConnector.md#spychangesigner) +- [spyActivate](TestUtils.MockConnector.md#spyactivate) +- [spyDeactivate](TestUtils.MockConnector.md#spydeactivate) + +### Constructors + +- [constructor](TestUtils.MockConnector.md#constructor) + +## Methods + +### once + +▸ `Static` **once**(`emitter`, `eventName`, `options?`): `Promise`<`any`[]\> + +Creates a `Promise` that is fulfilled when the `EventEmitter` emits the given +event or that is rejected if the `EventEmitter` emits `'error'` while waiting. +The `Promise` will resolve with an array of all the arguments emitted to the +given event. + +This method is intentionally generic and works with the web platform [EventTarget](https://dom.spec.whatwg.org/#interface-eventtarget) interface, which has no special`'error'` event +semantics and does not listen to the `'error'` event. + +```js +const { once, EventEmitter } = require('events'); + +async function run() { + const ee = new EventEmitter(); + + process.nextTick(() => { + ee.emit('myevent', 42); + }); + + const [value] = await once(ee, 'myevent'); + console.log(value); + + const err = new Error('kaboom'); + process.nextTick(() => { + ee.emit('error', err); + }); + + try { + await once(ee, 'myevent'); + } catch (err) { + console.log('error happened', err); + } +} + +run(); +``` + +The special handling of the `'error'` event is only used when `events.once()`is used to wait for another event. If `events.once()` is used to wait for the +'`error'` event itself, then it is treated as any other kind of event without +special handling: + +```js +const { EventEmitter, once } = require('events'); + +const ee = new EventEmitter(); + +once(ee, 'error') + .then(([err]) => console.log('ok', err.message)) + .catch((err) => console.log('error', err.message)); + +ee.emit('error', new Error('boom')); + +// Prints: ok boom +``` + +An `AbortSignal` can be used to cancel waiting for the event: + +```js +const { EventEmitter, once } = require('events'); + +const ee = new EventEmitter(); +const ac = new AbortController(); + +async function foo(emitter, event, signal) { + try { + await once(emitter, event, { signal }); + console.log('event emitted!'); + } catch (error) { + if (error.name === 'AbortError') { + console.error('Waiting for the event was canceled!'); + } else { + console.error('There was an error', error.message); + } + } +} + +foo(ee, 'foo', ac.signal); +ac.abort(); // Abort waiting for the event +ee.emit('foo'); // Prints: Waiting for the event was canceled! +``` + +**`since`** v11.13.0, v10.16.0 + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `emitter` | `NodeEventTarget` | +| `eventName` | `string` \| `symbol` | +| `options?` | `StaticEventEmitterOptions` | + +#### Returns + +`Promise`<`any`[]\> + +#### Inherited from + +AbstractConnector.once + +#### Defined in + +node_modules/@types/node/events.d.ts:157 + +▸ `Static` **once**(`emitter`, `eventName`, `options?`): `Promise`<`any`[]\> + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `emitter` | `DOMEventTarget` | +| `eventName` | `string` | +| `options?` | `StaticEventEmitterOptions` | + +#### Returns + +`Promise`<`any`[]\> + +#### Inherited from + +AbstractConnector.once + +#### Defined in + +node_modules/@types/node/events.d.ts:158 + +___ + +### on + +▸ `Static` **on**(`emitter`, `eventName`, `options?`): `AsyncIterableIterator`<`any`\> + +```js +const { on, EventEmitter } = require('events'); + +(async () => { + const ee = new EventEmitter(); + + // Emit later on + process.nextTick(() => { + ee.emit('foo', 'bar'); + ee.emit('foo', 42); + }); + + for await (const event of on(ee, 'foo')) { + // The execution of this inner block is synchronous and it + // processes one event at a time (even with await). Do not use + // if concurrent execution is required. + console.log(event); // prints ['bar'] [42] + } + // Unreachable here +})(); +``` + +Returns an `AsyncIterator` that iterates `eventName` events. It will throw +if the `EventEmitter` emits `'error'`. It removes all listeners when +exiting the loop. The `value` returned by each iteration is an array +composed of the emitted event arguments. + +An `AbortSignal` can be used to cancel waiting on events: + +```js +const { on, EventEmitter } = require('events'); +const ac = new AbortController(); + +(async () => { + const ee = new EventEmitter(); + + // Emit later on + process.nextTick(() => { + ee.emit('foo', 'bar'); + ee.emit('foo', 42); + }); + + for await (const event of on(ee, 'foo', { signal: ac.signal })) { + // The execution of this inner block is synchronous and it + // processes one event at a time (even with await). Do not use + // if concurrent execution is required. + console.log(event); // prints ['bar'] [42] + } + // Unreachable here +})(); + +process.nextTick(() => ac.abort()); +``` + +**`since`** v13.6.0, v12.16.0 + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `emitter` | `EventEmitter` | - | +| `eventName` | `string` | The name of the event being listened for | +| `options?` | `StaticEventEmitterOptions` | - | + +#### Returns + +`AsyncIterableIterator`<`any`\> + +that iterates `eventName` events emitted by the `emitter` + +#### Inherited from + +AbstractConnector.on + +#### Defined in + +node_modules/@types/node/events.d.ts:217 + +___ + +### listenerCount + +▸ `Static` **listenerCount**(`emitter`, `eventName`): `number` + +A class method that returns the number of listeners for the given `eventName`registered on the given `emitter`. + +```js +const { EventEmitter, listenerCount } = require('events'); +const myEmitter = new EventEmitter(); +myEmitter.on('event', () => {}); +myEmitter.on('event', () => {}); +console.log(listenerCount(myEmitter, 'event')); +// Prints: 2 +``` + +**`since`** v0.9.12 + +**`deprecated`** Since v3.2.0 - Use `listenerCount` instead. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `emitter` | `EventEmitter` | The emitter to query | +| `eventName` | `string` \| `symbol` | The event name | + +#### Returns + +`number` + +#### Inherited from + +AbstractConnector.listenerCount + +#### Defined in + +node_modules/@types/node/events.d.ts:234 + +___ + +### getEventListeners + +▸ `Static` **getEventListeners**(`emitter`, `name`): `Function`[] + +Returns a copy of the array of listeners for the event named `eventName`. + +For `EventEmitter`s this behaves exactly the same as calling `.listeners` on +the emitter. + +For `EventTarget`s this is the only way to get the event listeners for the +event target. This is useful for debugging and diagnostic purposes. + +```js +const { getEventListeners, EventEmitter } = require('events'); + +{ + const ee = new EventEmitter(); + const listener = () => console.log('Events are fun'); + ee.on('foo', listener); + getEventListeners(ee, 'foo'); // [listener] +} +{ + const et = new EventTarget(); + const listener = () => console.log('Events are fun'); + et.addEventListener('foo', listener); + getEventListeners(et, 'foo'); // [listener] +} +``` + +**`since`** v15.2.0 + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `emitter` | `DOMEventTarget` \| `EventEmitter` | +| `name` | `string` \| `symbol` | + +#### Returns + +`Function`[] + +#### Inherited from + +AbstractConnector.getEventListeners + +#### Defined in + +node_modules/@types/node/events.d.ts:262 + +___ + +### addListener + +▸ **addListener**(`eventName`, `listener`): [`MockConnector`](TestUtils.MockConnector.md) + +Alias for `emitter.on(eventName, listener)`. + +**`since`** v0.1.26 + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `eventName` | `string` \| `symbol` | +| `listener` | (...`args`: `any`[]) => `void` | + +#### Returns + +[`MockConnector`](TestUtils.MockConnector.md) + +#### Inherited from + +AbstractConnector.addListener + +#### Defined in + +node_modules/@types/node/events.d.ts:299 + +___ + +### on + +▸ **on**(`eventName`, `listener`): [`MockConnector`](TestUtils.MockConnector.md) + +Adds the `listener` function to the end of the listeners array for the +event named `eventName`. No checks are made to see if the `listener` has +already been added. Multiple calls passing the same combination of `eventName`and `listener` will result in the `listener` being added, and called, multiple +times. + +```js +server.on('connection', (stream) => { + console.log('someone connected!'); +}); +``` + +Returns a reference to the `EventEmitter`, so that calls can be chained. + +By default, event listeners are invoked in the order they are added. The`emitter.prependListener()` method can be used as an alternative to add the +event listener to the beginning of the listeners array. + +```js +const myEE = new EventEmitter(); +myEE.on('foo', () => console.log('a')); +myEE.prependListener('foo', () => console.log('b')); +myEE.emit('foo'); +// Prints: +// b +// a +``` + +**`since`** v0.1.101 + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `eventName` | `string` \| `symbol` | The name of the event. | +| `listener` | (...`args`: `any`[]) => `void` | The callback function | + +#### Returns + +[`MockConnector`](TestUtils.MockConnector.md) + +#### Inherited from + +AbstractConnector.on + +#### Defined in + +node_modules/@types/node/events.d.ts:330 + +___ + +### once + +▸ **once**(`eventName`, `listener`): [`MockConnector`](TestUtils.MockConnector.md) + +Adds a **one-time**`listener` function for the event named `eventName`. The +next time `eventName` is triggered, this listener is removed and then invoked. + +```js +server.once('connection', (stream) => { + console.log('Ah, we have our first user!'); +}); +``` + +Returns a reference to the `EventEmitter`, so that calls can be chained. + +By default, event listeners are invoked in the order they are added. The`emitter.prependOnceListener()` method can be used as an alternative to add the +event listener to the beginning of the listeners array. + +```js +const myEE = new EventEmitter(); +myEE.once('foo', () => console.log('a')); +myEE.prependOnceListener('foo', () => console.log('b')); +myEE.emit('foo'); +// Prints: +// b +// a +``` + +**`since`** v0.3.0 + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `eventName` | `string` \| `symbol` | The name of the event. | +| `listener` | (...`args`: `any`[]) => `void` | The callback function | + +#### Returns + +[`MockConnector`](TestUtils.MockConnector.md) + +#### Inherited from + +AbstractConnector.once + +#### Defined in + +node_modules/@types/node/events.d.ts:359 + +___ + +### removeListener + +▸ **removeListener**(`eventName`, `listener`): [`MockConnector`](TestUtils.MockConnector.md) + +Removes the specified `listener` from the listener array for the event named`eventName`. + +```js +const callback = (stream) => { + console.log('someone connected!'); +}; +server.on('connection', callback); +// ... +server.removeListener('connection', callback); +``` + +`removeListener()` will remove, at most, one instance of a listener from the +listener array. If any single listener has been added multiple times to the +listener array for the specified `eventName`, then `removeListener()` must be +called multiple times to remove each instance. + +Once an event is emitted, all listeners attached to it at the +time of emitting are called in order. This implies that any`removeListener()` or `removeAllListeners()` calls _after_ emitting and_before_ the last listener finishes execution will +not remove them from`emit()` in progress. Subsequent events behave as expected. + +```js +const myEmitter = new MyEmitter(); + +const callbackA = () => { + console.log('A'); + myEmitter.removeListener('event', callbackB); +}; + +const callbackB = () => { + console.log('B'); +}; + +myEmitter.on('event', callbackA); + +myEmitter.on('event', callbackB); + +// callbackA removes listener callbackB but it will still be called. +// Internal listener array at time of emit [callbackA, callbackB] +myEmitter.emit('event'); +// Prints: +// A +// B + +// callbackB is now removed. +// Internal listener array [callbackA] +myEmitter.emit('event'); +// Prints: +// A +``` + +Because listeners are managed using an internal array, calling this will +change the position indices of any listener registered _after_ the listener +being removed. This will not impact the order in which listeners are called, +but it means that any copies of the listener array as returned by +the `emitter.listeners()` method will need to be recreated. + +When a single function has been added as a handler multiple times for a single +event (as in the example below), `removeListener()` will remove the most +recently added instance. In the example the `once('ping')`listener is removed: + +```js +const ee = new EventEmitter(); + +function pong() { + console.log('pong'); +} + +ee.on('ping', pong); +ee.once('ping', pong); +ee.removeListener('ping', pong); + +ee.emit('ping'); +ee.emit('ping'); +``` + +Returns a reference to the `EventEmitter`, so that calls can be chained. + +**`since`** v0.1.26 + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `eventName` | `string` \| `symbol` | +| `listener` | (...`args`: `any`[]) => `void` | + +#### Returns + +[`MockConnector`](TestUtils.MockConnector.md) + +#### Inherited from + +AbstractConnector.removeListener + +#### Defined in + +node_modules/@types/node/events.d.ts:439 + +___ + +### off + +▸ **off**(`eventName`, `listener`): [`MockConnector`](TestUtils.MockConnector.md) + +Alias for `emitter.removeListener()`. + +**`since`** v10.0.0 + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `eventName` | `string` \| `symbol` | +| `listener` | (...`args`: `any`[]) => `void` | + +#### Returns + +[`MockConnector`](TestUtils.MockConnector.md) + +#### Inherited from + +AbstractConnector.off + +#### Defined in + +node_modules/@types/node/events.d.ts:444 + +___ + +### removeAllListeners + +▸ **removeAllListeners**(`event?`): [`MockConnector`](TestUtils.MockConnector.md) + +Removes all listeners, or those of the specified `eventName`. + +It is bad practice to remove listeners added elsewhere in the code, +particularly when the `EventEmitter` instance was created by some other +component or module (e.g. sockets or file streams). + +Returns a reference to the `EventEmitter`, so that calls can be chained. + +**`since`** v0.1.26 + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `event?` | `string` \| `symbol` | + +#### Returns + +[`MockConnector`](TestUtils.MockConnector.md) + +#### Inherited from + +AbstractConnector.removeAllListeners + +#### Defined in + +node_modules/@types/node/events.d.ts:455 + +___ + +### setMaxListeners + +▸ **setMaxListeners**(`n`): [`MockConnector`](TestUtils.MockConnector.md) + +By default `EventEmitter`s will print a warning if more than `10` listeners are +added for a particular event. This is a useful default that helps finding +memory leaks. The `emitter.setMaxListeners()` method allows the limit to be +modified for this specific `EventEmitter` instance. The value can be set to`Infinity` (or `0`) to indicate an unlimited number of listeners. + +Returns a reference to the `EventEmitter`, so that calls can be chained. + +**`since`** v0.3.5 + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `n` | `number` | + +#### Returns + +[`MockConnector`](TestUtils.MockConnector.md) + +#### Inherited from + +AbstractConnector.setMaxListeners + +#### Defined in + +node_modules/@types/node/events.d.ts:465 + +___ + +### getMaxListeners + +▸ **getMaxListeners**(): `number` + +Returns the current max listener value for the `EventEmitter` which is either +set by `emitter.setMaxListeners(n)` or defaults to [defaultMaxListeners](TestUtils.MockConnector.md#defaultmaxlisteners). + +**`since`** v1.0.0 + +#### Returns + +`number` + +#### Inherited from + +AbstractConnector.getMaxListeners + +#### Defined in + +node_modules/@types/node/events.d.ts:471 + +___ + +### listeners + +▸ **listeners**(`eventName`): `Function`[] + +Returns a copy of the array of listeners for the event named `eventName`. + +```js +server.on('connection', (stream) => { + console.log('someone connected!'); +}); +console.log(util.inspect(server.listeners('connection'))); +// Prints: [ [Function] ] +``` + +**`since`** v0.1.26 + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `eventName` | `string` \| `symbol` | + +#### Returns + +`Function`[] + +#### Inherited from + +AbstractConnector.listeners + +#### Defined in + +node_modules/@types/node/events.d.ts:484 + +___ + +### rawListeners + +▸ **rawListeners**(`eventName`): `Function`[] + +Returns a copy of the array of listeners for the event named `eventName`, +including any wrappers (such as those created by `.once()`). + +```js +const emitter = new EventEmitter(); +emitter.once('log', () => console.log('log once')); + +// Returns a new Array with a function `onceWrapper` which has a property +// `listener` which contains the original listener bound above +const listeners = emitter.rawListeners('log'); +const logFnWrapper = listeners[0]; + +// Logs "log once" to the console and does not unbind the `once` event +logFnWrapper.listener(); + +// Logs "log once" to the console and removes the listener +logFnWrapper(); + +emitter.on('log', () => console.log('log persistently')); +// Will return a new Array with a single function bound by `.on()` above +const newListeners = emitter.rawListeners('log'); + +// Logs "log persistently" twice +newListeners[0](); +emitter.emit('log'); +``` + +**`since`** v9.4.0 + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `eventName` | `string` \| `symbol` | + +#### Returns + +`Function`[] + +#### Inherited from + +AbstractConnector.rawListeners + +#### Defined in + +node_modules/@types/node/events.d.ts:514 + +___ + +### emit + +▸ **emit**(`eventName`, ...`args`): `boolean` + +Synchronously calls each of the listeners registered for the event named`eventName`, in the order they were registered, passing the supplied arguments +to each. + +Returns `true` if the event had listeners, `false` otherwise. + +```js +const EventEmitter = require('events'); +const myEmitter = new EventEmitter(); + +// First listener +myEmitter.on('event', function firstListener() { + console.log('Helloooo! first listener'); +}); +// Second listener +myEmitter.on('event', function secondListener(arg1, arg2) { + console.log(`event with parameters ${arg1}, ${arg2} in second listener`); +}); +// Third listener +myEmitter.on('event', function thirdListener(...args) { + const parameters = args.join(', '); + console.log(`event with parameters ${parameters} in third listener`); +}); + +console.log(myEmitter.listeners('event')); + +myEmitter.emit('event', 1, 2, 3, 4, 5); + +// Prints: +// [ +// [Function: firstListener], +// [Function: secondListener], +// [Function: thirdListener] +// ] +// Helloooo! first listener +// event with parameters 1, 2 in second listener +// event with parameters 1, 2, 3, 4, 5 in third listener +``` + +**`since`** v0.1.26 + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `eventName` | `string` \| `symbol` | +| `...args` | `any`[] | + +#### Returns + +`boolean` + +#### Inherited from + +AbstractConnector.emit + +#### Defined in + +node_modules/@types/node/events.d.ts:555 + +___ + +### listenerCount + +▸ **listenerCount**(`eventName`): `number` + +Returns the number of listeners listening to the event named `eventName`. + +**`since`** v3.2.0 + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `eventName` | `string` \| `symbol` | The name of the event being listened for | + +#### Returns + +`number` + +#### Inherited from + +AbstractConnector.listenerCount + +#### Defined in + +node_modules/@types/node/events.d.ts:561 + +___ + +### prependListener + +▸ **prependListener**(`eventName`, `listener`): [`MockConnector`](TestUtils.MockConnector.md) + +Adds the `listener` function to the _beginning_ of the listeners array for the +event named `eventName`. No checks are made to see if the `listener` has +already been added. Multiple calls passing the same combination of `eventName`and `listener` will result in the `listener` being added, and called, multiple +times. + +```js +server.prependListener('connection', (stream) => { + console.log('someone connected!'); +}); +``` + +Returns a reference to the `EventEmitter`, so that calls can be chained. + +**`since`** v6.0.0 + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `eventName` | `string` \| `symbol` | The name of the event. | +| `listener` | (...`args`: `any`[]) => `void` | The callback function | + +#### Returns + +[`MockConnector`](TestUtils.MockConnector.md) + +#### Inherited from + +AbstractConnector.prependListener + +#### Defined in + +node_modules/@types/node/events.d.ts:579 + +___ + +### prependOnceListener + +▸ **prependOnceListener**(`eventName`, `listener`): [`MockConnector`](TestUtils.MockConnector.md) + +Adds a **one-time**`listener` function for the event named `eventName` to the_beginning_ of the listeners array. The next time `eventName` is triggered, this +listener is removed, and then invoked. + +```js +server.prependOnceListener('connection', (stream) => { + console.log('Ah, we have our first user!'); +}); +``` + +Returns a reference to the `EventEmitter`, so that calls can be chained. + +**`since`** v6.0.0 + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `eventName` | `string` \| `symbol` | The name of the event. | +| `listener` | (...`args`: `any`[]) => `void` | The callback function | + +#### Returns + +[`MockConnector`](TestUtils.MockConnector.md) + +#### Inherited from + +AbstractConnector.prependOnceListener + +#### Defined in + +node_modules/@types/node/events.d.ts:595 + +___ + +### eventNames + +▸ **eventNames**(): (`string` \| `symbol`)[] + +Returns an array listing the events for which the emitter has registered +listeners. The values in the array are strings or `Symbol`s. + +```js +const EventEmitter = require('events'); +const myEE = new EventEmitter(); +myEE.on('foo', () => {}); +myEE.on('bar', () => {}); + +const sym = Symbol('symbol'); +myEE.on(sym, () => {}); + +console.log(myEE.eventNames()); +// Prints: [ 'foo', 'bar', Symbol(symbol) ] +``` + +**`since`** v6.0.0 + +#### Returns + +(`string` \| `symbol`)[] + +#### Inherited from + +AbstractConnector.eventNames + +#### Defined in + +node_modules/@types/node/events.d.ts:614 + +___ + +### emitUpdate + +▸ `Protected` **emitUpdate**(`update`): `void` + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `update` | `ConnectorUpdate`<`string` \| `number`\> | + +#### Returns + +`void` + +#### Inherited from + +AbstractConnector.emitUpdate + +#### Defined in + +node_modules/@web3-react/core/node_modules/@web3-react/abstract-connector/dist/index.d.ts:12 + +___ + +### emitError + +▸ `Protected` **emitError**(`error`): `void` + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `error` | `Error` | + +#### Returns + +`void` + +#### Inherited from + +AbstractConnector.emitError + +#### Defined in + +node_modules/@web3-react/core/node_modules/@web3-react/abstract-connector/dist/index.d.ts:13 + +___ + +### emitDeactivate + +▸ `Protected` **emitDeactivate**(): `void` + +#### Returns + +`void` + +#### Inherited from + +AbstractConnector.emitDeactivate + +#### Defined in + +node_modules/@web3-react/core/node_modules/@web3-react/abstract-connector/dist/index.d.ts:14 + +___ + +### replaceWithSpies + +▸ **replaceWithSpies**(): `void` + +#### Returns + +`void` + +#### Defined in + +[src/helpers/test-utils/wrapper/MockConnector.ts:33](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/helpers/test-utils/wrapper/MockConnector.ts#L33) + +___ + +### hasCachedProvider + +▸ **hasCachedProvider**(): `boolean` + +#### Returns + +`boolean` + +#### Implementation of + +[ICommonModalConnector](../interfaces/EthersContext.ICommonModalConnector.md).[hasCachedProvider](../interfaces/EthersContext.ICommonModalConnector.md#hascachedprovider) + +#### Defined in + +[src/helpers/test-utils/wrapper/MockConnector.ts:39](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/helpers/test-utils/wrapper/MockConnector.ts#L39) + +___ + +### getSigner + +▸ **getSigner**(): `undefined` \| `Signer` + +#### Returns + +`undefined` \| `Signer` + +#### Implementation of + +[ICommonModalConnector](../interfaces/EthersContext.ICommonModalConnector.md).[getSigner](../interfaces/EthersContext.ICommonModalConnector.md#getsigner) + +#### Defined in + +[src/helpers/test-utils/wrapper/MockConnector.ts:43](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/helpers/test-utils/wrapper/MockConnector.ts#L43) + +___ + +### setModalTheme + +▸ **setModalTheme**(`_theme`): `void` + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `_theme` | ``"light"`` \| ``"dark"`` \| `ThemeColors` | + +#### Returns + +`void` + +#### Implementation of + +[ICommonModalConnector](../interfaces/EthersContext.ICommonModalConnector.md).[setModalTheme](../interfaces/EthersContext.ICommonModalConnector.md#setmodaltheme) + +#### Defined in + +[src/helpers/test-utils/wrapper/MockConnector.ts:46](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/helpers/test-utils/wrapper/MockConnector.ts#L46) + +___ + +### resetModal + +▸ **resetModal**(): `void` + +#### Returns + +`void` + +#### Implementation of + +[ICommonModalConnector](../interfaces/EthersContext.ICommonModalConnector.md).[resetModal](../interfaces/EthersContext.ICommonModalConnector.md#resetmodal) + +#### Defined in + +[src/helpers/test-utils/wrapper/MockConnector.ts:49](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/helpers/test-utils/wrapper/MockConnector.ts#L49) + +___ + +### changeSigner + +▸ **changeSigner**(`_signer`): `Promise`<`void`\> + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `_signer` | `Signer` | + +#### Returns + +`Promise`<`void`\> + +#### Implementation of + +[ICommonModalConnector](../interfaces/EthersContext.ICommonModalConnector.md).[changeSigner](../interfaces/EthersContext.ICommonModalConnector.md#changesigner) + +#### Defined in + +[src/helpers/test-utils/wrapper/MockConnector.ts:53](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/helpers/test-utils/wrapper/MockConnector.ts#L53) + +___ + +### activate + +▸ **activate**(): `Promise`<`ConnectorUpdate`<`string` \| `number`\>\> + +#### Returns + +`Promise`<`ConnectorUpdate`<`string` \| `number`\>\> + +#### Overrides + +AbstractConnector.activate + +#### Defined in + +[src/helpers/test-utils/wrapper/MockConnector.ts:61](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/helpers/test-utils/wrapper/MockConnector.ts#L61) + +___ + +### getProvider + +▸ **getProvider**(): `Promise`<[`TEthersProvider`](../modules/Models.md#tethersprovider) \| `MockProvider`\> + +#### Returns + +`Promise`<[`TEthersProvider`](../modules/Models.md#tethersprovider) \| `MockProvider`\> + +#### Overrides + +AbstractConnector.getProvider + +#### Defined in + +[src/helpers/test-utils/wrapper/MockConnector.ts:69](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/helpers/test-utils/wrapper/MockConnector.ts#L69) + +___ + +### getChainId + +▸ **getChainId**(): `Promise`<`number`\> + +#### Returns + +`Promise`<`number`\> + +#### Overrides + +AbstractConnector.getChainId + +#### Defined in + +[src/helpers/test-utils/wrapper/MockConnector.ts:73](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/helpers/test-utils/wrapper/MockConnector.ts#L73) + +___ + +### getAccount + +▸ **getAccount**(): `Promise`<`string`\> + +#### Returns + +`Promise`<`string`\> + +#### Overrides + +AbstractConnector.getAccount + +#### Defined in + +[src/helpers/test-utils/wrapper/MockConnector.ts:77](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/helpers/test-utils/wrapper/MockConnector.ts#L77) + +___ + +### setMockAccount + +▸ **setMockAccount**(`hardhatAccountIndex`): `Promise`<`string`\> + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `hardhatAccountIndex` | `number` | + +#### Returns + +`Promise`<`string`\> + +#### Defined in + +[src/helpers/test-utils/wrapper/MockConnector.ts:82](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/helpers/test-utils/wrapper/MockConnector.ts#L82) + +___ + +### deactivate + +▸ **deactivate**(): `void` + +#### Returns + +`void` + +#### Overrides + +AbstractConnector.deactivate + +#### Defined in + +[src/helpers/test-utils/wrapper/MockConnector.ts:87](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/helpers/test-utils/wrapper/MockConnector.ts#L87) + +## Properties + +### errorMonitor + +▪ `Static` `Readonly` **errorMonitor**: typeof [`errorMonitor`](EthersContext.EthersModalConnector.md#errormonitor) + +This symbol shall be used to install a listener for only monitoring `'error'` +events. Listeners installed using this symbol are called before the regular +`'error'` listeners are called. + +Installing a listener using this symbol does not change the behavior once an +`'error'` event is emitted, therefore the process will still crash if no +regular `'error'` listener is installed. + +#### Inherited from + +AbstractConnector.errorMonitor + +#### Defined in + +node_modules/@types/node/events.d.ts:272 + +___ + +### captureRejectionSymbol + +▪ `Static` `Readonly` **captureRejectionSymbol**: typeof [`captureRejectionSymbol`](EthersContext.EthersModalConnector.md#capturerejectionsymbol) + +#### Inherited from + +AbstractConnector.captureRejectionSymbol + +#### Defined in + +node_modules/@types/node/events.d.ts:273 + +___ + +### captureRejections + +▪ `Static` **captureRejections**: `boolean` + +Sets or gets the default captureRejection value for all emitters. + +#### Inherited from + +AbstractConnector.captureRejections + +#### Defined in + +node_modules/@types/node/events.d.ts:278 + +___ + +### defaultMaxListeners + +▪ `Static` **defaultMaxListeners**: `number` + +#### Inherited from + +AbstractConnector.defaultMaxListeners + +#### Defined in + +node_modules/@types/node/events.d.ts:279 + +___ + +### supportedChainIds + +• `Optional` `Readonly` **supportedChainIds**: `number`[] + +#### Inherited from + +AbstractConnector.supportedChainIds + +#### Defined in + +node_modules/@web3-react/core/node_modules/@web3-react/abstract-connector/dist/index.d.ts:5 + +___ + +### provider + +• `Protected` **provider**: `MockProvider` + +#### Defined in + +[src/helpers/test-utils/wrapper/MockConnector.ts:14](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/helpers/test-utils/wrapper/MockConnector.ts#L14) + +___ + +### mockChainId + +• `Protected` **mockChainId**: `number` + +#### Defined in + +[src/helpers/test-utils/wrapper/MockConnector.ts:15](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/helpers/test-utils/wrapper/MockConnector.ts#L15) + +___ + +### mockSigner + +• `Protected` **mockSigner**: `undefined` \| `Signer` + +#### Defined in + +[src/helpers/test-utils/wrapper/MockConnector.ts:17](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/helpers/test-utils/wrapper/MockConnector.ts#L17) + +___ + +### mockAccount + +• `Protected` **mockAccount**: `undefined` \| `string` + +#### Defined in + +[src/helpers/test-utils/wrapper/MockConnector.ts:18](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/helpers/test-utils/wrapper/MockConnector.ts#L18) + +___ + +### spyResetModal + +• **spyResetModal**: `SinonStub`<[], `void`\> + +#### Defined in + +[src/helpers/test-utils/wrapper/MockConnector.ts:20](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/helpers/test-utils/wrapper/MockConnector.ts#L20) + +___ + +### spySetModalTheme + +• **spySetModalTheme**: `SinonStub`<[\_theme: "light" \| "dark" \| ThemeColors], `void`\> + +#### Defined in + +[src/helpers/test-utils/wrapper/MockConnector.ts:21](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/helpers/test-utils/wrapper/MockConnector.ts#L21) + +___ + +### spyChangeSigner + +• **spyChangeSigner**: `SinonStub`<[\_signer: Signer], `Promise`<`void`\>\> + +#### Defined in + +[src/helpers/test-utils/wrapper/MockConnector.ts:22](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/helpers/test-utils/wrapper/MockConnector.ts#L22) + +___ + +### spyActivate + +• **spyActivate**: `SinonStub`<`any`[], `any`\> + +#### Defined in + +[src/helpers/test-utils/wrapper/MockConnector.ts:23](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/helpers/test-utils/wrapper/MockConnector.ts#L23) + +___ + +### spyDeactivate + +• **spyDeactivate**: `SinonStub`<`any`[], `any`\> + +#### Defined in + +[src/helpers/test-utils/wrapper/MockConnector.ts:24](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/helpers/test-utils/wrapper/MockConnector.ts#L24) + +## Constructors + +### constructor + +• **new MockConnector**(`provider`) + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `provider` | `MockProvider` | + +#### Overrides + +AbstractConnector.constructor + +#### Defined in + +[src/helpers/test-utils/wrapper/MockConnector.ts:26](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/helpers/test-utils/wrapper/MockConnector.ts#L26) diff --git a/docs/api-typedocs/interfaces/EthersContext.ICommonModalConnector.md b/docs/api-typedocs/interfaces/EthersContext.ICommonModalConnector.md index 4bdd6d9a..8fd62fba 100644 --- a/docs/api-typedocs/interfaces/EthersContext.ICommonModalConnector.md +++ b/docs/api-typedocs/interfaces/EthersContext.ICommonModalConnector.md @@ -1,4 +1,4 @@ -[eth-hooks - v3.4.0](../README.md) / [EthersContext](../modules/EthersContext.md) / ICommonModalConnector +[eth-hooks - v4.0.8](../README.md) / [EthersContext](../modules/EthersContext.md) / ICommonModalConnector # Interface: ICommonModalConnector @@ -10,6 +10,7 @@ An interface implemented by [EthersModalConnector](../classes/EthersContext.Ethe ## Implemented by - [`EthersModalConnector`](../classes/EthersContext.EthersModalConnector.md) +- [`MockConnector`](../classes/TestUtils.MockConnector.md) ## Table of contents @@ -19,6 +20,7 @@ An interface implemented by [EthersModalConnector](../classes/EthersContext.Ethe - [setModalTheme](EthersContext.ICommonModalConnector.md#setmodaltheme) - [resetModal](EthersContext.ICommonModalConnector.md#resetmodal) - [changeSigner](EthersContext.ICommonModalConnector.md#changesigner) +- [hasCachedProvider](EthersContext.ICommonModalConnector.md#hascachedprovider) ## Methods @@ -32,7 +34,7 @@ An interface implemented by [EthersModalConnector](../classes/EthersContext.Ethe #### Defined in -[src/context/connectors/EthersModalConnector.ts:39](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/context/connectors/EthersModalConnector.ts#L39) +[src/context/ethers/connectors/EthersModalConnector.ts:38](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/context/ethers/connectors/EthersModalConnector.ts#L38) ___ @@ -44,7 +46,7 @@ ___ | Name | Type | | :------ | :------ | -| `theme` | `ThemeColors` \| `TWeb3ModalTheme` | +| `theme` | `TWeb3ModalTheme` \| `ThemeColors` | #### Returns @@ -52,7 +54,7 @@ ___ #### Defined in -[src/context/connectors/EthersModalConnector.ts:40](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/context/connectors/EthersModalConnector.ts#L40) +[src/context/ethers/connectors/EthersModalConnector.ts:39](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/context/ethers/connectors/EthersModalConnector.ts#L39) ___ @@ -66,7 +68,7 @@ ___ #### Defined in -[src/context/connectors/EthersModalConnector.ts:41](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/context/connectors/EthersModalConnector.ts#L41) +[src/context/ethers/connectors/EthersModalConnector.ts:40](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/context/ethers/connectors/EthersModalConnector.ts#L40) ___ @@ -86,4 +88,18 @@ ___ #### Defined in -[src/context/connectors/EthersModalConnector.ts:42](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/context/connectors/EthersModalConnector.ts#L42) +[src/context/ethers/connectors/EthersModalConnector.ts:41](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/context/ethers/connectors/EthersModalConnector.ts#L41) + +___ + +### hasCachedProvider + +▸ **hasCachedProvider**(): `boolean` + +#### Returns + +`boolean` + +#### Defined in + +[src/context/ethers/connectors/EthersModalConnector.ts:42](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/context/ethers/connectors/EthersModalConnector.ts#L42) diff --git a/docs/api-typedocs/interfaces/EthersContext.IStaticJsonRpcProviderConnectorOptions.md b/docs/api-typedocs/interfaces/EthersContext.IStaticJsonRpcProviderConnectorOptions.md index 7d72de2f..68529ecd 100644 --- a/docs/api-typedocs/interfaces/EthersContext.IStaticJsonRpcProviderConnectorOptions.md +++ b/docs/api-typedocs/interfaces/EthersContext.IStaticJsonRpcProviderConnectorOptions.md @@ -1,4 +1,4 @@ -[eth-hooks - v3.4.0](../README.md) / [EthersContext](../modules/EthersContext.md) / IStaticJsonRpcProviderConnectorOptions +[eth-hooks - v4.0.8](../README.md) / [EthersContext](../modules/EthersContext.md) / IStaticJsonRpcProviderConnectorOptions # Interface: IStaticJsonRpcProviderConnectorOptions @@ -48,7 +48,7 @@ ___ #### Defined in -[src/context/connectors/StaticJsonRpcProviderConnector.ts:12](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/context/connectors/StaticJsonRpcProviderConnector.ts#L12) +[src/context/ethers/connectors/StaticJsonRpcProviderConnector.ts:12](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/context/ethers/connectors/StaticJsonRpcProviderConnector.ts#L12) ___ @@ -58,4 +58,4 @@ ___ #### Defined in -[src/context/connectors/StaticJsonRpcProviderConnector.ts:13](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/context/connectors/StaticJsonRpcProviderConnector.ts#L13) +[src/context/ethers/connectors/StaticJsonRpcProviderConnector.ts:13](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/context/ethers/connectors/StaticJsonRpcProviderConnector.ts#L13) diff --git a/docs/api-typedocs/interfaces/Models.IContractFactoryBridge.md b/docs/api-typedocs/interfaces/Models.IContractFactoryBridge.md deleted file mode 100644 index dcc955f9..00000000 --- a/docs/api-typedocs/interfaces/Models.IContractFactoryBridge.md +++ /dev/null @@ -1,34 +0,0 @@ -[eth-hooks - v3.4.0](../README.md) / [Models](../modules/Models.md) / IContractFactoryBridge - -# Interface: IContractFactoryBridge - -[Models](../modules/Models.md).IContractFactoryBridge - -In progress... - -## Table of contents - -### Methods - -- [connect](Models.IContractFactoryBridge.md#connect) - -## Methods - -### connect - -▸ **connect**(`address`, `signerOrProvider`): `BaseContract` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `address` | `string` | -| `signerOrProvider` | `Signer` \| `Provider` | - -#### Returns - -`BaseContract` - -#### Defined in - -[src/models/contractTypes.ts:8](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/models/contractTypes.ts#L8) diff --git a/docs/api-typedocs/interfaces/EthersContext.IEthersContext.md b/docs/api-typedocs/interfaces/Models.IEthersContext.md similarity index 55% rename from docs/api-typedocs/interfaces/EthersContext.IEthersContext.md rename to docs/api-typedocs/interfaces/Models.IEthersContext.md index 29c7bf50..2b55f8a9 100644 --- a/docs/api-typedocs/interfaces/EthersContext.IEthersContext.md +++ b/docs/api-typedocs/interfaces/Models.IEthersContext.md @@ -1,8 +1,8 @@ -[eth-hooks - v3.4.0](../README.md) / [EthersContext](../modules/EthersContext.md) / IEthersContext +[eth-hooks - v4.0.8](../README.md) / [Models](../modules/Models.md) / IEthersContext # Interface: IEthersContext -[EthersContext](../modules/EthersContext.md).IEthersContext +[Models](../modules/Models.md).IEthersContext #### Summary The return type of [EthersModalConnector](../classes/EthersContext.EthersModalConnector.md) @@ -21,24 +21,24 @@ The return type of [EthersModalConnector](../classes/EthersContext.EthersModalCo ### Methods -- [activate](EthersContext.IEthersContext.md#activate) -- [setError](EthersContext.IEthersContext.md#seterror) -- [deactivate](EthersContext.IEthersContext.md#deactivate) -- [openModal](EthersContext.IEthersContext.md#openmodal) -- [disconnectModal](EthersContext.IEthersContext.md#disconnectmodal) +- [activate](Models.IEthersContext.md#activate) +- [setError](Models.IEthersContext.md#seterror) +- [deactivate](Models.IEthersContext.md#deactivate) +- [openModal](Models.IEthersContext.md#openmodal) +- [disconnectModal](Models.IEthersContext.md#disconnectmodal) ### Properties -- [library](EthersContext.IEthersContext.md#library) -- [error](EthersContext.IEthersContext.md#error) -- [connector](EthersContext.IEthersContext.md#connector) -- [ethersProvider](EthersContext.IEthersContext.md#ethersprovider) -- [active](EthersContext.IEthersContext.md#active) -- [signer](EthersContext.IEthersContext.md#signer) -- [account](EthersContext.IEthersContext.md#account) -- [chainId](EthersContext.IEthersContext.md#chainid) -- [changeSigner](EthersContext.IEthersContext.md#changesigner) -- [setModalTheme](EthersContext.IEthersContext.md#setmodaltheme) +- [library](Models.IEthersContext.md#library) +- [error](Models.IEthersContext.md#error) +- [connector](Models.IEthersContext.md#connector) +- [provider](Models.IEthersContext.md#provider) +- [active](Models.IEthersContext.md#active) +- [signer](Models.IEthersContext.md#signer) +- [account](Models.IEthersContext.md#account) +- [chainId](Models.IEthersContext.md#chainid) +- [changeSigner](Models.IEthersContext.md#changesigner) +- [setModalTheme](Models.IEthersContext.md#setmodaltheme) ## Methods @@ -126,7 +126,7 @@ ___ #### Defined in -[src/context/EthersAppContext.tsx:43](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/context/EthersAppContext.tsx#L43) +[src/models/ethersAppContextTypes.ts:37](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/models/ethersAppContextTypes.ts#L37) ___ @@ -140,7 +140,7 @@ ___ #### Defined in -[src/context/EthersAppContext.tsx:44](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/context/EthersAppContext.tsx#L44) +[src/models/ethersAppContextTypes.ts:38](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/models/ethersAppContextTypes.ts#L38) ## Properties @@ -182,17 +182,17 @@ Web3ReactContextInterface.connector #### Defined in -[src/context/EthersAppContext.tsx:36](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/context/EthersAppContext.tsx#L36) +[src/models/ethersAppContextTypes.ts:30](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/models/ethersAppContextTypes.ts#L30) ___ -### ethersProvider +### provider -• **ethersProvider**: `undefined` \| [`TEthersProvider`](../modules/Models.md#tethersprovider) +• **provider**: `undefined` \| [`TEthersProvider`](../modules/Models.md#tethersprovider) #### Defined in -[src/context/EthersAppContext.tsx:37](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/context/EthersAppContext.tsx#L37) +[src/models/ethersAppContextTypes.ts:31](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/models/ethersAppContextTypes.ts#L31) ___ @@ -206,17 +206,17 @@ Web3ReactContextInterface.active #### Defined in -[src/context/EthersAppContext.tsx:38](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/context/EthersAppContext.tsx#L38) +[src/models/ethersAppContextTypes.ts:32](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/models/ethersAppContextTypes.ts#L32) ___ ### signer -• **signer**: `undefined` \| `Signer` +• **signer**: `undefined` \| [`TEthersSigner`](../modules/Models.md#tetherssigner) #### Defined in -[src/context/EthersAppContext.tsx:39](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/context/EthersAppContext.tsx#L39) +[src/models/ethersAppContextTypes.ts:33](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/models/ethersAppContextTypes.ts#L33) ___ @@ -230,7 +230,7 @@ Web3ReactContextInterface.account #### Defined in -[src/context/EthersAppContext.tsx:40](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/context/EthersAppContext.tsx#L40) +[src/models/ethersAppContextTypes.ts:34](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/models/ethersAppContextTypes.ts#L34) ___ @@ -244,7 +244,7 @@ Web3ReactContextInterface.chainId #### Defined in -[src/context/EthersAppContext.tsx:41](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/context/EthersAppContext.tsx#L41) +[src/models/ethersAppContextTypes.ts:35](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/models/ethersAppContextTypes.ts#L35) ___ @@ -254,7 +254,7 @@ ___ #### Defined in -[src/context/EthersAppContext.tsx:42](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/context/EthersAppContext.tsx#L42) +[src/models/ethersAppContextTypes.ts:36](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/models/ethersAppContextTypes.ts#L36) ___ @@ -264,4 +264,4 @@ ___ #### Defined in -[src/context/EthersAppContext.tsx:45](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/context/EthersAppContext.tsx#L45) +[src/models/ethersAppContextTypes.ts:39](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/models/ethersAppContextTypes.ts#L39) diff --git a/docs/api-typedocs/interfaces/Models.TypedEvent.md b/docs/api-typedocs/interfaces/Models.TypedEvent.md deleted file mode 100644 index 70245fa9..00000000 --- a/docs/api-typedocs/interfaces/Models.TypedEvent.md +++ /dev/null @@ -1,322 +0,0 @@ -[eth-hooks - v3.4.0](../README.md) / [Models](../modules/Models.md) / TypedEvent - -# Interface: TypedEvent - -[Models](../modules/Models.md).TypedEvent - -## Type parameters - -| Name | Type | -| :------ | :------ | -| `EventArgs` | extends `Result` | - -## Hierarchy - -- `Event` - - ↳ **`TypedEvent`** - -## Table of contents - -### Properties - -- [event](Models.TypedEvent.md#event) -- [eventSignature](Models.TypedEvent.md#eventsignature) -- [decodeError](Models.TypedEvent.md#decodeerror) -- [blockNumber](Models.TypedEvent.md#blocknumber) -- [blockHash](Models.TypedEvent.md#blockhash) -- [transactionIndex](Models.TypedEvent.md#transactionindex) -- [removed](Models.TypedEvent.md#removed) -- [address](Models.TypedEvent.md#address) -- [data](Models.TypedEvent.md#data) -- [topics](Models.TypedEvent.md#topics) -- [transactionHash](Models.TypedEvent.md#transactionhash) -- [logIndex](Models.TypedEvent.md#logindex) -- [args](Models.TypedEvent.md#args) - -### Methods - -- [decode](Models.TypedEvent.md#decode) -- [removeListener](Models.TypedEvent.md#removelistener) -- [getBlock](Models.TypedEvent.md#getblock) -- [getTransaction](Models.TypedEvent.md#gettransaction) -- [getTransactionReceipt](Models.TypedEvent.md#gettransactionreceipt) - -## Properties - -### event - -• `Optional` **event**: `string` - -#### Inherited from - -Event.event - -#### Defined in - -node_modules/@ethersproject/contracts/lib/index.d.ts:43 - -___ - -### eventSignature - -• `Optional` **eventSignature**: `string` - -#### Inherited from - -Event.eventSignature - -#### Defined in - -node_modules/@ethersproject/contracts/lib/index.d.ts:44 - -___ - -### decodeError - -• `Optional` **decodeError**: `Error` - -#### Inherited from - -Event.decodeError - -#### Defined in - -node_modules/@ethersproject/contracts/lib/index.d.ts:46 - -___ - -### blockNumber - -• **blockNumber**: `number` - -#### Inherited from - -Event.blockNumber - -#### Defined in - -node_modules/@ethersproject/contracts/node_modules/@ethersproject/abstract-provider/lib/index.d.ts:52 - -___ - -### blockHash - -• **blockHash**: `string` - -#### Inherited from - -Event.blockHash - -#### Defined in - -node_modules/@ethersproject/contracts/node_modules/@ethersproject/abstract-provider/lib/index.d.ts:53 - -___ - -### transactionIndex - -• **transactionIndex**: `number` - -#### Inherited from - -Event.transactionIndex - -#### Defined in - -node_modules/@ethersproject/contracts/node_modules/@ethersproject/abstract-provider/lib/index.d.ts:54 - -___ - -### removed - -• **removed**: `boolean` - -#### Inherited from - -Event.removed - -#### Defined in - -node_modules/@ethersproject/contracts/node_modules/@ethersproject/abstract-provider/lib/index.d.ts:55 - -___ - -### address - -• **address**: `string` - -#### Inherited from - -Event.address - -#### Defined in - -node_modules/@ethersproject/contracts/node_modules/@ethersproject/abstract-provider/lib/index.d.ts:56 - -___ - -### data - -• **data**: `string` - -#### Inherited from - -Event.data - -#### Defined in - -node_modules/@ethersproject/contracts/node_modules/@ethersproject/abstract-provider/lib/index.d.ts:57 - -___ - -### topics - -• **topics**: `string`[] - -#### Inherited from - -Event.topics - -#### Defined in - -node_modules/@ethersproject/contracts/node_modules/@ethersproject/abstract-provider/lib/index.d.ts:58 - -___ - -### transactionHash - -• **transactionHash**: `string` - -#### Inherited from - -Event.transactionHash - -#### Defined in - -node_modules/@ethersproject/contracts/node_modules/@ethersproject/abstract-provider/lib/index.d.ts:59 - -___ - -### logIndex - -• **logIndex**: `number` - -#### Inherited from - -Event.logIndex - -#### Defined in - -node_modules/@ethersproject/contracts/node_modules/@ethersproject/abstract-provider/lib/index.d.ts:60 - -___ - -### args - -• **args**: `EventArgs` - -#### Overrides - -Event.args - -#### Defined in - -[src/models/providerTypes.ts:66](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/models/providerTypes.ts#L66) - -## Methods - -### decode - -▸ `Optional` **decode**(`data`, `topics?`): `any` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `data` | `string` | -| `topics?` | `string`[] | - -#### Returns - -`any` - -#### Inherited from - -Event.decode - -#### Defined in - -node_modules/@ethersproject/contracts/lib/index.d.ts:47 - -___ - -### removeListener - -▸ **removeListener**(): `void` - -#### Returns - -`void` - -#### Inherited from - -Event.removeListener - -#### Defined in - -node_modules/@ethersproject/contracts/lib/index.d.ts:48 - -___ - -### getBlock - -▸ **getBlock**(): `Promise`<`Block`\> - -#### Returns - -`Promise`<`Block`\> - -#### Inherited from - -Event.getBlock - -#### Defined in - -node_modules/@ethersproject/contracts/lib/index.d.ts:49 - -___ - -### getTransaction - -▸ **getTransaction**(): `Promise`<`TransactionResponse`\> - -#### Returns - -`Promise`<`TransactionResponse`\> - -#### Inherited from - -Event.getTransaction - -#### Defined in - -node_modules/@ethersproject/contracts/lib/index.d.ts:50 - -___ - -### getTransactionReceipt - -▸ **getTransactionReceipt**(): `Promise`<`TransactionReceipt`\> - -#### Returns - -`Promise`<`TransactionReceipt`\> - -#### Inherited from - -Event.getTransactionReceipt - -#### Defined in - -node_modules/@ethersproject/contracts/lib/index.d.ts:51 diff --git a/docs/api-typedocs/modules/EthersContext.md b/docs/api-typedocs/modules/EthersContext.md index 9ea44f69..9564eb2e 100644 --- a/docs/api-typedocs/modules/EthersContext.md +++ b/docs/api-typedocs/modules/EthersContext.md @@ -1,8 +1,8 @@ -[eth-hooks - v3.4.0](../README.md) / EthersContext +[eth-hooks - v4.0.8](../README.md) / EthersContext # Module: EthersContext -A context for your react app with [useEthersContext](EthersContext.md#useetherscontext) that provides you access to [IEthersContext](../interfaces/EthersContext.IEthersContext.md). It gives you access to consistent interface to get the current provider [EthersModalConnector](../classes/EthersContext.EthersModalConnector.md). Additionally integration with web3Modal gives you an easy way to guide your user with their web3 journey. +A context for your react app with [useEthersContext](EthersContext.md#useetherscontext) that provides you access to [IEthersContext](../interfaces/Models.IEthersContext.md). It gives you access to consistent interface to get the current provider [EthersModalConnector](../classes/EthersContext.EthersModalConnector.md). Additionally integration with web3Modal gives you an easy way to guide your user with their web3 journey. ## Table of contents @@ -12,22 +12,32 @@ A context for your react app with [useEthersContext](EthersContext.md#useethersc - [useEthersContext](EthersContext.md#useetherscontext) - [ConnectToStaticJsonRpcProvider](EthersContext.md#connecttostaticjsonrpcprovider) +### Misc Functions + +- [createConnectorForHardhatContract](EthersContext.md#createconnectorforhardhatcontract) +- [createConnectorForExternalContract](EthersContext.md#createconnectorforexternalcontract) +- [createConnectorForExternalAbi](EthersContext.md#createconnectorforexternalabi) +- [connectToContractWithAdaptor](EthersContext.md#connecttocontractwithadaptor) +- [contractsContextFactory](EthersContext.md#contractscontextfactory) + +### Type aliases + +- [TContractsContextProps](EthersContext.md#tcontractscontextprops) +- [TContractsContextActions](EthersContext.md#tcontractscontextactions) +- [TEthersAppContextProps](EthersContext.md#tethersappcontextprops) +- [TEthersModalConnector](EthersContext.md#tethersmodalconnector) + ### EthersContext Variables - [BlockNumberContext](EthersContext.md#blocknumbercontext) - [EthersAppContext](EthersContext.md#ethersappcontext) -### EthersContext Type aliases - -- [CreateEthersModalConnector](EthersContext.md#createethersmodalconnector) +### Misc Variables -### Misc Type aliases - -- [TEthersModalConnector](EthersContext.md#tethersmodalconnector) +- [contextQueryClient](EthersContext.md#contextqueryclient) ### EthersContext Interfaces -- [IEthersContext](../interfaces/EthersContext.IEthersContext.md) - [IStaticJsonRpcProviderConnectorOptions](../interfaces/EthersContext.IStaticJsonRpcProviderConnectorOptions.md) ### Misc Interfaces @@ -57,7 +67,7 @@ Make sure to wrap your main app with the [EthersAppContext](EthersContext.md#eth #### Notes - this extensively used by eth-hooks to trigger hooks when a new block arrives -- uses the current provider [ethersProvider](../interfaces/EthersContext.IEthersContext.md#ethersprovider) from [useEthersContext](EthersContext.md#useetherscontext) +- uses the current provider {@link ethersProvider} from [useEthersContext](EthersContext.md#useetherscontext) #### Returns @@ -67,17 +77,17 @@ current block number #### Defined in -[src/context/BlockNumberContext.tsx:62](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/context/BlockNumberContext.tsx#L62) +[src/context/ethers/BlockNumberContext.tsx:64](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/context/ethers/BlockNumberContext.tsx#L64) ___ ### useEthersContext -▸ `Const` **useEthersContext**(`providerKey?`): [`IEthersContext`](../interfaces/EthersContext.IEthersContext.md) +▸ `Const` **useEthersContext**(`contextKey?`): [`IEthersContext`](../interfaces/Models.IEthersContext.md) #### Summary This Hook provides you with access to the current Ethers Provider Context. -This provider would be the one selected by using {@link EthersModalConnector} and Web3Modal +This provider would be the one selected by using [EthersModalConnector](../classes/EthersContext.EthersModalConnector.md) and Web3Modal #### Features Gives you access to consistent interface to get the current provider information [EthersModalConnector](../classes/EthersContext.EthersModalConnector.md) @@ -93,15 +103,15 @@ Gives you access to consistent interface to get the current provider information | Name | Type | | :------ | :------ | -| `providerKey?` | `string` | +| `contextKey?` | `string` | #### Returns -[`IEthersContext`](../interfaces/EthersContext.IEthersContext.md) +[`IEthersContext`](../interfaces/Models.IEthersContext.md) #### Defined in -[src/context/EthersAppContext.tsx:75](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/context/EthersAppContext.tsx#L75) +[src/context/ethers/EthersAppContext.tsx:37](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/context/ethers/EthersAppContext.tsx#L37) ___ @@ -130,72 +140,229 @@ See scaffold-eth-typescript for an example that uses it to connect to a localhos #### Defined in -[src/context/connectors/StaticJsonRpcProviderConnector.ts:31](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/context/connectors/StaticJsonRpcProviderConnector.ts#L31) +[src/context/ethers/connectors/StaticJsonRpcProviderConnector.ts:31](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/context/ethers/connectors/StaticJsonRpcProviderConnector.ts#L31) -## EthersContext Variables +___ -### BlockNumberContext +## Misc Functions -• **BlockNumberContext**: `FC`<`IProps`\> +### createConnectorForHardhatContract -#### Summary -A context that works with [useBlockNumberContext](EthersContext.md#useblocknumbercontext) to give access to the current provider's block number in any place in your app +▸ `Const` **createConnectorForHardhatContract**<`GContractNames`, `GBaseContract`, `GContractInterface`\>(`contractName`, `typechainFactory`, `deployedHardhatContractJson`): [`TContractConnector`](Models.md#tcontractconnector)<`GContractNames`, `GBaseContract`, `GContractInterface`\> -**`param`** +#### Type parameters -**`returns`** +| Name | Type | +| :------ | :------ | +| `GContractNames` | extends `string` | +| `GBaseContract` | extends `BaseContract`<`GBaseContract`\> | +| `GContractInterface` | extends `Interface`<`GContractInterface`\> | + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `contractName` | `GContractNames` | +| `typechainFactory` | [`TConnectorConnectorBase`](Models.md#tconnectorconnectorbase)<`GBaseContract`, `GContractInterface`\> | +| `deployedHardhatContractJson` | [`TDeployedHardhatContractsJson`](Models.md#tdeployedhardhatcontractsjson) | + +#### Returns + +[`TContractConnector`](Models.md#tcontractconnector)<`GContractNames`, `GBaseContract`, `GContractInterface`\> #### Defined in -[src/context/BlockNumberContext.tsx:84](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/context/BlockNumberContext.tsx#L84) +[src/context/app-contracts/contractConnectors.ts:44](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/context/app-contracts/contractConnectors.ts#L44) ___ -### EthersAppContext +### createConnectorForExternalContract -• **EthersAppContext**: `FC` +▸ `Const` **createConnectorForExternalContract**<`GContractNames`, `GBaseContract`, `GContractInterface`\>(`contractName`, `typechainFactory`, `deployedContractJson`): [`TContractConnector`](Models.md#tcontractconnector)<`GContractNames`, `GBaseContract`, `GContractInterface`\> -#### Summary -Ethers App Context for your react app to be used with [useEthersContext](EthersContext.md#useetherscontext). -This is a wrapper around Web3ReactProvider that provides additional functionality such as a [BlockNumberContext](EthersContext.md#blocknumbercontext) and access to [IEthersContext](../interfaces/EthersContext.IEthersContext.md) +#### Type parameters -**`param`** +| Name | Type | +| :------ | :------ | +| `GContractNames` | extends `string` | +| `GBaseContract` | extends `BaseContract`<`GBaseContract`\> | +| `GContractInterface` | extends `Interface`<`GContractInterface`\> | -**`returns`** +#### Parameters + +| Name | Type | +| :------ | :------ | +| `contractName` | `GContractNames` | +| `typechainFactory` | [`TConnectorConnectorBase`](Models.md#tconnectorconnectorbase)<`GBaseContract`, `GContractInterface`\> | +| `deployedContractJson` | [`TExternalContractsAddressMap`](Models.md#texternalcontractsaddressmap) | + +#### Returns + +[`TContractConnector`](Models.md#tcontractconnector)<`GContractNames`, `GBaseContract`, `GContractInterface`\> + +#### Defined in + +[src/context/app-contracts/contractConnectors.ts:74](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/context/app-contracts/contractConnectors.ts#L74) + +___ + +### createConnectorForExternalAbi + +▸ `Const` **createConnectorForExternalAbi**<`GContractNames`\>(`contractName`, `config`, `abi`): [`TContractConnector`](Models.md#tcontractconnector)<`GContractNames`, `BaseContract`, `Interface`\> + +#### Type parameters + +| Name | Type | +| :------ | :------ | +| `GContractNames` | extends `string` | + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `contractName` | `GContractNames` | +| `config` | `Object` | +| `abi` | `Record`<`string`, `any`\>[] | + +#### Returns + +[`TContractConnector`](Models.md#tcontractconnector)<`GContractNames`, `BaseContract`, `Interface`\> + +#### Defined in + +[src/context/app-contracts/contractConnectors.ts:104](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/context/app-contracts/contractConnectors.ts#L104) + +___ + +### connectToContractWithAdaptor + +▸ `Const` **connectToContractWithAdaptor**<`GContractNames`, `GContract`, `GContractInterface`\>(`connector`, `adaptor`): `undefined` \| `GContract` + +#### Type parameters + +| Name | Type | +| :------ | :------ | +| `GContractNames` | extends `string` | +| `GContract` | extends `BaseContract`<`GContract`\> | +| `GContractInterface` | extends `Interface`<`GContractInterface`\> | + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `connector` | [`TContractConnector`](Models.md#tcontractconnector)<`GContractNames`, `GContract`, `GContractInterface`\> | +| `adaptor` | [`TEthersAdaptor`](Models.md#tethersadaptor) | + +#### Returns + +`undefined` \| `GContract` #### Defined in -[src/context/EthersAppContext.tsx:168](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/context/EthersAppContext.tsx#L168) +[src/context/app-contracts/contractConnectors.ts:120](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/context/app-contracts/contractConnectors.ts#L120) + +___ -## EthersContext Type aliases +### contractsContextFactory -### CreateEthersModalConnector +▸ `Const` **contractsContextFactory**<`GContractNames`, `GAppConnectorList`, `GContractTypes`\>(`loadAppContractConnectors`): `Object` -Ƭ **CreateEthersModalConnector**: () => [`TEthersModalConnector`](EthersContext.md#tethersmodalconnector) \| `undefined` +#### Type parameters + +| Name | Type | +| :------ | :------ | +| `GContractNames` | extends `string` | +| `GAppConnectorList` | `GAppConnectorList` | +| `GContractTypes` | extends `unknown` | + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `loadAppContractConnectors` | () => `undefined` \| `GAppConnectorList` | + +#### Returns + +`Object` + +| Name | Type | +| :------ | :------ | +| `ContractsAppContext` | `FC`<`PropsWithChildren`<[`TContractsContextProps`](EthersContext.md#tcontractscontextprops)\>\> | +| `useAppContractsActions` | () => `undefined` \| [`TContractsContextActions`](EthersContext.md#tcontractscontextactions)<`GContractNames`, `GAppConnectorList`\> | +| `useAppContractsContext` | (`contractName`: `GContractNames`, `chainId`: `undefined` \| `number`) => `undefined` \| `GContract` | +| `useLoadAppContracts` | () => `void` | +| `useConnectAppContracts` | (`adaptor`: `undefined` \| [`TEthersAdaptor`](Models.md#tethersadaptor)) => `void` | + +#### Defined in + +[src/context/app-contracts/contractsContextFactory.tsx:79](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/context/app-contracts/contractsContextFactory.tsx#L79) + +## Type aliases + +### TContractsContextProps + +Ƭ **TContractsContextProps**: `Object` #### Type declaration -▸ (): [`TEthersModalConnector`](EthersContext.md#tethersmodalconnector) \| `undefined` +| Name | Type | +| :------ | :------ | +| `ethersContextKey?` | `string` | -#### Summary -A callback type that returns a EthersModalConnector +#### Defined in -#### Notes -- can be used by components that need to give a connector to [IEthersContext.openModal](../interfaces/EthersContext.IEthersContext.md#openmodal) +[src/context/app-contracts/contractsContextFactory.tsx:22](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/context/app-contracts/contractsContextFactory.tsx#L22) -**`category`** EthersContext +___ + +### TContractsContextActions + +Ƭ **TContractsContextActions**<`GContractNames`, `GAppConnectorList`\>: `Object` -##### Returns +#### Type parameters -[`TEthersModalConnector`](EthersContext.md#tethersmodalconnector) \| `undefined` +| Name | Type | +| :------ | :------ | +| `GContractNames` | extends `string` | +| `GAppConnectorList` | `GAppConnectorList` | + +#### Type declaration + +| Name | Type | +| :------ | :------ | +| `connectToAllContractsAction` | (`appContractConnectorList`: `GAppConnectorList`, `ethersAdaptor`: `undefined` \| [`TEthersAdaptor`](Models.md#tethersadaptor)) => `void` | +| `connectToContractAction` | (`contractName`: `GContractNames`, `ethersAdaptor`: [`TEthersAdaptor`](Models.md#tethersadaptor)) => `void` | +| `setContractConnectors` | (`appContractConnectorList`: `GAppConnectorList`) => `void` | +| `addContractConnectors` | (`appContractConnectorList`: `GAppConnectorList`) => `void` | +| `dispatch` | `Dispatch`<`TActions`<`GContractNames`, `GAppConnectorList`\>\> | #### Defined in -[src/context/EthersAppContext.tsx:23](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/context/EthersAppContext.tsx#L23) +[src/context/app-contracts/contractsContextFactory.tsx:60](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/context/app-contracts/contractsContextFactory.tsx#L60) ___ -## Misc Type aliases +### TEthersAppContextProps + +Ƭ **TEthersAppContextProps**: `Object` + +#### Summary +Props for context that allow you specify alternate web3ReactRoot [See docs](https://github.com/NoahZinsmeister/web3-react/tree/v6/docs#createweb3reactroot). You must provide both an alternate key and its root. + +#### Type declaration + +| Name | Type | +| :------ | :------ | +| `secondaryWeb3ReactRoot?` | `Object` | +| `secondaryWeb3ReactRoot.contextKey` | `string` | +| `secondaryWeb3ReactRoot.web3ReactRoot` | `JSX.Element` | +| `disableQueryClientRoot?` | `boolean` | + +#### Defined in + +[src/context/ethers/EthersAppContext.tsx:97](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/context/ethers/EthersAppContext.tsx#L97) + +___ ### TEthersModalConnector @@ -203,4 +370,51 @@ ___ #### Defined in -[src/context/connectors/EthersModalConnector.ts:45](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/context/connectors/EthersModalConnector.ts#L45) +[src/context/ethers/connectors/EthersModalConnector.ts:45](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/context/ethers/connectors/EthersModalConnector.ts#L45) + +## EthersContext Variables + +### BlockNumberContext + +• **BlockNumberContext**: `FC`<`IProps`\> + +#### Summary +A context that works with [useBlockNumberContext](EthersContext.md#useblocknumbercontext) to give access to the current provider's block number in any place in your app + +**`param`** + +**`returns`** + +#### Defined in + +[src/context/ethers/BlockNumberContext.tsx:86](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/context/ethers/BlockNumberContext.tsx#L86) + +___ + +### EthersAppContext + +• **EthersAppContext**: `FC`<[`TEthersAppContextProps`](EthersContext.md#tethersappcontextprops)\> + +#### Summary +Ethers App Context for your react app to be used with [useEthersContext](EthersContext.md#useetherscontext). +This is a wrapper around Web3ReactProvider that provides additional functionality such as a [BlockNumberContext](EthersContext.md#blocknumbercontext) and access to [IEthersContext](../interfaces/Models.IEthersContext.md). See [TEthersAppContextProps](EthersContext.md#tethersappcontextprops) for more information on props for alternate context roots. + +**`param`** + +**`returns`** + +#### Defined in + +[src/context/ethers/EthersAppContext.tsx:144](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/context/ethers/EthersAppContext.tsx#L144) + +___ + +## Misc Variables + +### contextQueryClient + +• **contextQueryClient**: `QueryClient` + +#### Defined in + +[src/context/ethers/queryClient.ts:3](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/context/ethers/queryClient.ts#L3) diff --git a/docs/api-typedocs/modules/Helpers.md b/docs/api-typedocs/modules/Helpers.md index 91e1271d..fb065fb5 100644 --- a/docs/api-typedocs/modules/Helpers.md +++ b/docs/api-typedocs/modules/Helpers.md @@ -1,4 +1,4 @@ -[eth-hooks - v3.4.0](../README.md) / Helpers +[eth-hooks - v4.0.8](../README.md) / Helpers # Module: Helpers @@ -34,7 +34,7 @@ const ExampleUI = lazier(() => import('./exampleui/ExampleUI'), 'ExampleUI'); | Name | Type | Description | | :------ | :------ | :------ | -| `importFactory` | () => `Promise`<`Object`\> | a callback that imports e.g. () => import('./exampleui/ExampleUI') | +| `importFactory` | () => `Promise`<{ [name: string]: `T`; }\> | a callback that imports e.g. () => import('./exampleui/ExampleUI') | | `importName` | `string` | the named export you want to import. | #### Returns @@ -43,4 +43,4 @@ const ExampleUI = lazier(() => import('./exampleui/ExampleUI'), 'ExampleUI'); #### Defined in -[src/helpers/lazier.ts:18](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/helpers/lazier.ts#L18) +[src/helpers/lazier.ts:18](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/helpers/lazier.ts#L18) diff --git a/docs/api-typedocs/modules/Hooks.md b/docs/api-typedocs/modules/Hooks.md index 5b1cd71c..f14aaaf2 100644 --- a/docs/api-typedocs/modules/Hooks.md +++ b/docs/api-typedocs/modules/Hooks.md @@ -1,4 +1,4 @@ -[eth-hooks - v3.4.0](../README.md) / Hooks +[eth-hooks - v4.0.8](../README.md) / Hooks # Module: Hooks @@ -13,37 +13,40 @@ Commonly used ethereum hooks to turbocharge your development! Works with [useEt - [useResolveEnsAddress](Hooks.md#useresolveensaddress) - [useResolveEnsName](Hooks.md#useresolveensname) - [useTokenBalance](Hooks.md#usetokenbalance) +- [useAreSignerEqual](Hooks.md#usearesignerequal) - [useBalance](Hooks.md#usebalance) - [useBlockNumber](Hooks.md#useblocknumber) - [useBurnerSigner](Hooks.md#useburnersigner) - [useContractExistsAtAddress](Hooks.md#usecontractexistsataddress) - [useContractLoader](Hooks.md#usecontractloader) -- [useContractReader](Hooks.md#usecontractreader) +- [useContractReaderUntyped](Hooks.md#usecontractreaderuntyped) +- [useEthersAdaptorFromProviderOrSigners](Hooks.md#useethersadaptorfromproviderorsigners) - [useEventListener](Hooks.md#useeventlistener) - [useGasPrice](Hooks.md#usegasprice) -- [useGetUserFromProviders](Hooks.md#usegetuserfromproviders) -- [useGetUserFromSigners](Hooks.md#usegetuserfromsigners) - [useNonce](Hooks.md#usenonce) -- [useOnRepetition](Hooks.md#useonrepetition) +- [useSignerAddress](Hooks.md#usesigneraddress) +- [useSignerChainId](Hooks.md#usesignerchainid) - [useTimestamp](Hooks.md#usetimestamp) -- [useUserAddress](Hooks.md#useuseraddress) -- [useWeb3Modal](Hooks.md#useweb3modal) ### Misc Functions - [parseContractsInJson](Hooks.md#parsecontractsinjson) +- [useContractReader](Hooks.md#usecontractreader) ### Hooks Type aliases - [TBurnerSigner](Hooks.md#tburnersigner) - [TGasStationSpeed](Hooks.md#tgasstationspeed) -- [TWeb3ModalState](Hooks.md#tweb3modalstate) + +### Models Type aliases + +- [TContractLoaderConfig](Hooks.md#tcontractloaderconfig) ## Hooks Functions ### useDexEthPrice -▸ `Const` **useDexEthPrice**(`mainnetProvider`, `targetNetworkInfo?`, `pollTime?`): `number` +▸ `Const` **useDexEthPrice**(`mainnetProvider`, `targetNetworkInfo?`, `options?`): [price: number, update: Function] #### Summary Get the Exchange price of ETH/USD (extrapolated from WETH/DAI) from uniswap @@ -53,27 +56,27 @@ Get the Exchange price of ETH/USD (extrapolated from WETH/DAI) from uniswap #### Parameters -| Name | Type | Default value | Description | -| :------ | :------ | :------ | :------ | -| `mainnetProvider` | `undefined` \| [`TEthersProvider`](Models.md#tethersprovider) | `undefined` | | -| `targetNetworkInfo?` | [`TNetworkInfo`](Models.md#tnetworkinfo) | `undefined` | | -| `pollTime` | `number` | `0` | if >0 use polling, else use instead of onBlock event | +| Name | Type | +| :------ | :------ | +| `mainnetProvider` | `undefined` \| [`TEthersProvider`](Models.md#tethersprovider) | +| `targetNetworkInfo?` | [`TNetworkInfo`](Models.md#tnetworkinfo) | +| `options` | [`TUpdateOptions`](Models.md#tupdateoptions) | #### Returns -`number` +[price: number, update: Function] price in USD #### Defined in -[src/hooks/dapps/useDexEthPrice.ts:22](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/hooks/dapps/useDexEthPrice.ts#L22) +[src/hooks/dapps/useDexEthPrice.ts:27](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/hooks/dapps/useDexEthPrice.ts#L27) ___ ### useDexTokenList -▸ `Const` **useDexTokenList**(`tokenListUri?`, `chainId?`): `TokenInfo`[] +▸ `Const` **useDexTokenList**(`tokenListUri?`, `chainId?`, `options?`): [tokenList: TokenInfo[], update: Function] #### Summary Gets a tokenlist from uniswap ipfs tokenlist @@ -87,22 +90,23 @@ Gets a tokenlist from uniswap ipfs tokenlist | :------ | :------ | :------ | :------ | | `tokenListUri` | `string` | `'https://gateway.ipfs.io/ipns/tokens.uniswap.org'` | | | `chainId?` | `number` | `undefined` | optional, you can filter by a particular chainId | +| `options` | [`TUpdateOptions`](Models.md#tupdateoptions) | `undefined` | - | #### Returns -`TokenInfo`[] +[tokenList: TokenInfo[], update: Function] (TokenInfo[]) from '@uniswap/token-lists' #### Defined in -[src/hooks/dapps/useDexTokenList.ts:19](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/hooks/dapps/useDexTokenList.ts#L19) +[src/hooks/dapps/useDexTokenList.ts:27](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/hooks/dapps/useDexTokenList.ts#L27) ___ ### useResolveEnsAddress -▸ `Const` **useResolveEnsAddress**(`mainnetProvider`, `ensName`): `string` +▸ `Const` **useResolveEnsAddress**(`mainnetProvider`, `ensName`): [address: string, update: Function] #### Summary Gets the address from an ENS name @@ -111,22 +115,22 @@ Gets the address from an ENS name | Name | Type | Description | | :------ | :------ | :------ | -| `mainnetProvider` | [`TEthersProvider`](Models.md#tethersprovider) | mainnet provider | -| `ensName` | `string` | | +| `mainnetProvider` | `undefined` \| [`TEthersProvider`](Models.md#tethersprovider) | mainnet provider | +| `ensName` | `undefined` \| `string` | | #### Returns -`string` +[address: string, update: Function] #### Defined in -[src/hooks/dapps/useResolveEnsAddress.ts:16](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/hooks/dapps/useResolveEnsAddress.ts#L16) +[src/hooks/dapps/useResolveEnsAddress.ts:19](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/hooks/dapps/useResolveEnsAddress.ts#L19) ___ ### useResolveEnsName -▸ `Const` **useResolveEnsName**(`mainnetProvider`, `address`): `string` +▸ `Const` **useResolveEnsName**(`mainnetProvider`, `address`): [ensName: string, update: Function] #### Summary Gets ENS name for given address @@ -140,17 +144,17 @@ Gets ENS name for given address #### Returns -`string` +[ensName: string, update: Function] #### Defined in -[src/hooks/dapps/useResolveEnsName.ts:44](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/hooks/dapps/useResolveEnsName.ts#L44) +[src/hooks/dapps/useResolveEnsName.ts:45](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/hooks/dapps/useResolveEnsName.ts#L45) ___ ### useTokenBalance -▸ `Const` **useTokenBalance**(`contract`, `address`, `pollTime?`): `BigNumber` +▸ `Const` **useTokenBalance**<`GContract`\>(`contract`, `address`, `options?`): [balance: BigNumber, update: Function] #### Summary Get the balance of an ERC20 token in an address @@ -159,81 +163,119 @@ Get the balance of an ERC20 token in an address #### Notes - uses useOnRepetition +#### Type parameters + +| Name | Type | +| :------ | :------ | +| `GContract` | extends `BaseContract`<`GContract`\> & `ERC20` | + #### Parameters -| Name | Type | Default value | Description | -| :------ | :------ | :------ | :------ | -| `contract` | `Contract` | `undefined` | ethers.Contract class | -| `address` | `string` | `undefined` | | -| `pollTime` | `number` | `0` | if >0 use polling, else use instead of onBlock event | +| Name | Type | Description | +| :------ | :------ | :------ | +| `contract` | `GContract` | ethers.Contract class | +| `address` | `string` | | +| `options` | [`TUpdateOptions`](Models.md#tupdateoptions) | - | + +#### Returns + +[balance: BigNumber, update: Function] + +#### Defined in + +[src/hooks/erc/useTokenBalance.ts:33](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/hooks/erc/useTokenBalance.ts#L33) + +___ + +### useAreSignerEqual + +▸ `Const` **useAreSignerEqual**(`signer1`, `signer2`): [isEqual: boolean, update: Function] + +#### Summary +Are the signers equal and valid + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `signer1` | `undefined` \| [`TEthersSigner`](Models.md#tetherssigner) | +| `signer2` | `undefined` \| [`TEthersSigner`](Models.md#tetherssigner) | #### Returns -`BigNumber` +[isEqual: boolean, update: Function] #### Defined in -[src/hooks/erc/useTokenBalance.ts:39](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/hooks/erc/useTokenBalance.ts#L39) +[src/hooks/useAreSignerEqual.ts:17](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/hooks/useAreSignerEqual.ts#L17) ___ ### useBalance -▸ `Const` **useBalance**(`address`): `BigNumber` +▸ `Const` **useBalance**<`GAddress`, `GResult`\>(`addresses`, `override?`, `options?`): [balance: GResult, update: Function] #### Summary Gets your balance in ETH for the given address. #### Notes - updates triggered by [BlockNumberContext](EthersContext.md#blocknumbercontext) -- uses the current provider [ethersProvider](../interfaces/EthersContext.IEthersContext.md#ethersprovider) from [useEthersContext](EthersContext.md#useetherscontext) +- uses the current provider {@link provider} from [useEthersContext](EthersContext.md#useetherscontext) + +#### Type parameters + +| Name | Type | +| :------ | :------ | +| `GAddress` | extends `string` \| `string`[] | +| `GResult` | `TUseBalanceResult`<`GAddress`\> | #### Parameters | Name | Type | | :------ | :------ | -| `address` | `undefined` \| `string` | +| `addresses` | `undefined` \| `GAddress` | +| `override` | [`TOverride`](Models.md#toverride) | +| `options` | [`TUpdateOptions`](Models.md#tupdateoptions) | #### Returns -`BigNumber` +[balance: GResult, update: Function] current balance #### Defined in -[src/hooks/useBalance.ts:21](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/hooks/useBalance.ts#L21) +[src/hooks/useBalance.ts:34](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/hooks/useBalance.ts#L34) ___ ### useBlockNumber -▸ `Const` **useBlockNumber**(`provider`, `pollTime?`): `number` +▸ `Const` **useBlockNumber**(`provider`, `callback?`): [blockNumber: number, update: Function] #### Summary Get the current block number of the network. ✋🏽 @deprecated #### Notes -- ✋🏽 For app wide block number access use [BlockNumberContext](EthersContext.md#blocknumbercontext) instead -- ⚠ Deprecated -- uses the current ethersProvider from context +- ✋🏽 For app wide block number access use [useBlockNumberContext](EthersContext.md#useblocknumbercontext) instead. See [BlockNumberContext](EthersContext.md#blocknumbercontext) for more details, you get this as part of [EthersAppContext](EthersContext.md#ethersappcontext) +- uses the current provided block number #### Parameters -| Name | Type | Default value | Description | -| :------ | :------ | :------ | :------ | -| `provider` | [`TEthersProvider`](Models.md#tethersprovider) | `undefined` | | -| `pollTime` | `number` | `0` | if > 0 uses polling, else it uses onBlock event | +| Name | Type | +| :------ | :------ | +| `provider` | `undefined` \| [`TEthersProvider`](Models.md#tethersprovider) | +| `callback?` | (`blockNumber?`: `number`) => `void` \| (`blockNumber?`: `number`) => `Promise`<`void`\> | #### Returns -`number` +[blockNumber: number, update: Function] block number #### Defined in -[src/hooks/useBlockNumber.ts:22](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/hooks/useBlockNumber.ts#L22) +[src/hooks/useBlockNumber.ts:19](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/hooks/useBlockNumber.ts#L19) ___ @@ -259,13 +301,13 @@ IBurnerSigner #### Defined in -[src/hooks/useBurnerSigner.ts:87](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/hooks/useBurnerSigner.ts#L87) +[src/hooks/useBurnerSigner.ts:87](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/hooks/useBurnerSigner.ts#L87) ___ ### useContractExistsAtAddress -▸ `Const` **useContractExistsAtAddress**(`contract`): `boolean` +▸ `Const` **useContractExistsAtAddress**(`contract`, `options?`): [contractIsDeployed: boolean, update: Function] #### Summary Checks whether a contract exists on the blockchain @@ -278,27 +320,30 @@ Checks whether a contract exists on the blockchain | Name | Type | Description | | :------ | :------ | :------ | -| `contract` | `undefined` \| `Contract` | ethers.Contract class | +| `contract` | `undefined` \| `BaseContract` | ethers.BaseContract class | +| `options` | [`TUpdateOptions`](Models.md#tupdateoptions) | - | #### Returns -`boolean` +[contractIsDeployed: boolean, update: Function] #### Defined in -[src/hooks/useContractExistsAtAddress.ts:19](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/hooks/useContractExistsAtAddress.ts#L19) +[src/hooks/useContractExistsAtAddress.ts:25](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/hooks/useContractExistsAtAddress.ts#L25) ___ ### useContractLoader -▸ `Const` **useContractLoader**(`config?`, `providerOrSigner?`, `configChainId?`): `Record`<`string`, `BaseContract`\> +▸ `Const` **useContractLoader**(`config?`, `providerOrSigner`): `Record`<`string`, `BaseContract`\> #### Summary - Loads your contracts returns them and gives options to read values from contracts -or write transactions into them +Loads your contracts and returns them. ✋🏽 @deprecated +Gives options to read values from contracts or write transactions into them. #### Notes +- ✋🏽 For easy app wide contract access use {@link AppContractContex} created by [contractsContextFactory](EthersContext.md#contractscontextfactory). See [contractsContextFactory](EthersContext.md#contractscontextfactory) for more details. + A optional providerOrSigner is needed to initalize the contract class - if none is given, the context providerOrSigner is used if the chainId is the same. - A signer is required for write contracts @@ -311,9 +356,8 @@ ChainId | Name | Type | Description | | :------ | :------ | :------ | -| `config` | [`TContractLoaderConfig`](Models.md#tcontractloaderconfig) | | -| `providerOrSigner?` | [`TEthersProviderOrSigner`](Models.md#tethersproviderorsigner) | (optional) used to initalize the contract class | -| `configChainId?` | `number` | (optional) can be used to target specific a particular network (such as mainnet) instead of the current provider | +| `config` | [`TContractLoaderConfig`](Hooks.md#tcontractloaderconfig) | | +| `providerOrSigner` | `undefined` \| [`TEthersProviderOrSigner`](Models.md#tethersproviderorsigner) | (optional) used to initalize the contract class | #### Returns @@ -323,13 +367,13 @@ Record of contractName:Contracts #### Defined in -[src/hooks/useContractLoader.ts:58](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/hooks/useContractLoader.ts#L58) +[src/hooks/useContractLoader.ts:105](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/hooks/useContractLoader.ts#L105) ___ -### useContractReader +### useContractReaderUntyped -▸ `Const` **useContractReader**<`OutputT`\>(`contract`, `contractFunctionInfo`, `formatter?`, `onChange?`): `undefined` \| `OutputT` +▸ `Const` **useContractReaderUntyped**<`GOutput`\>(`contract`, `contractFunctionInfo`, `formatter?`, `onChange?`, `override?`): `undefined` \| `GOutput` #### Summary Enables you to call a contract function with arguments and receive the output. You can use this to easily track of contract outputs in react states @@ -340,9 +384,9 @@ Enables you to call a contract function with arguments and receive the output. #### Type parameters -| Name | Description | -| :------ | :------ | -| `OutputT` | return type | +| Name | +| :------ | +| `GOutput` | #### Parameters @@ -350,53 +394,86 @@ Enables you to call a contract function with arguments and receive the output. | :------ | :------ | :------ | | `contract` | `BaseContract` | ethers.Contract class | | `contractFunctionInfo` | [`TContractFunctionInfo`](Models.md#tcontractfunctioninfo) | | -| `formatter?` | (`_value`: `undefined` \| `OutputT`) => `OutputT` | a function that can format the output | -| `onChange?` | (`_value?`: `OutputT`) => `void` | callback with result as a parameter | +| `formatter?` | (`_value`: `undefined` \| `GOutput`) => `GOutput` | a function that can format the output | +| `onChange?` | (`_value?`: `GOutput`) => `void` | callback with result as a parameter | +| `override` | [`TOverride`](Models.md#toverride) | - | #### Returns -`undefined` \| `OutputT` +`undefined` \| `GOutput` #### Defined in -[src/hooks/useContractReader.ts:25](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/hooks/useContractReader.ts#L25) +[src/hooks/useContractReader.ts:109](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/hooks/useContractReader.ts#L109) + +___ + +### useEthersAdaptorFromProviderOrSigners + +▸ `Const` **useEthersAdaptorFromProviderOrSigners**(`providerOrSigner`, `options?`): [adaptor: TEthersAdaptor, update: Function] + +#### Summary +Gets the user {@link TEthersUser} for a signer or wallet + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `providerOrSigner` | `undefined` \| [`TEthersProviderOrSigner`](Models.md#tethersproviderorsigner) | input signer | +| `options` | [`TUpdateOptions`](Models.md#tupdateoptions) | - | + +#### Returns + +[adaptor: TEthersAdaptor, update: Function] + +#### Defined in + +[src/hooks/useEthersAdaptorFromProviderOrSigners.ts:30](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/hooks/useEthersAdaptorFromProviderOrSigners.ts#L30) ___ ### useEventListener -▸ `Const` **useEventListener**(`contract`, `eventName`, `startBlock`): [`TypedEvent`](../interfaces/Models.TypedEvent.md)<`Result`\>[] +▸ `Const` **useEventListener**<`GTypedEvent`\>(`contract`, `eventFilter`, `startBlock`, `toBlock?`, `options?`): [eventMap: GTypedEvent[], queryEvents: Function] #### Summary Tracks the events of associated with a contract #### Notes - updates triggered through ethers event listener -- uses the current provider [ethersProvider](../interfaces/EthersContext.IEthersContext.md#ethersprovider) from [useEthersContext](EthersContext.md#useetherscontext) +- uses the current provider {@link ethersProvider} from [useEthersContext](EthersContext.md#useetherscontext) + +#### Type parameters + +| Name | Type | +| :------ | :------ | +| `GTypedEvent` | extends [`TypedEvent`](Models.md#typedevent)<`Result`\> | #### Parameters -| Name | Type | Description | -| :------ | :------ | :------ | -| `contract` | `undefined` \| `Contract` | ethers.Contract | -| `eventName` | `string` \| `EventFilter` | | -| `startBlock` | `number` | | +| Name | Type | Default value | Description | +| :------ | :------ | :------ | :------ | +| `contract` | `undefined` \| `BaseContract` | `undefined` | ethers.Contract | +| `eventFilter` | `undefined` \| `string` \| `EventFilter` | `undefined` | - | +| `startBlock` | `number` | `undefined` | | +| `toBlock` | `undefined` \| `number` | `undefined` | - | +| `options` | [`TUpdateOptions`](Models.md#tupdateoptions) | `undefined` | - | #### Returns -[`TypedEvent`](../interfaces/Models.TypedEvent.md)<`Result`\>[] +[eventMap: GTypedEvent[], queryEvents: Function] #### Defined in -[src/hooks/useEventListener.ts:26](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/hooks/useEventListener.ts#L26) +[src/hooks/useEventListener.ts:26](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/hooks/useEventListener.ts#L26) ___ ### useGasPrice -▸ `Const` **useGasPrice**(`chainId`, `speed`, `currentNetworkInfo?`): `undefined` \| `number` +▸ `Const` **useGasPrice**(`chainId`, `speed`, `currentNetworkInfo?`, `override?`, `options?`): [gasPrice: number, update: Function] #### Summary Gets the gas price for the current network as gwei @@ -407,7 +484,7 @@ Gets the gas price for the current network as gwei #### Notes - if the gas price is unknown it returns undefined - updates triggered by [BlockNumberContext](EthersContext.md#blocknumbercontext) -- uses the current provider [ethersProvider](../interfaces/EthersContext.IEthersContext.md#ethersprovider) from [useEthersContext](EthersContext.md#useetherscontext) +- uses the current provider {@link ethersProvider} from [useEthersContext](EthersContext.md#useetherscontext) #### Parameters @@ -416,221 +493,183 @@ Gets the gas price for the current network as gwei | `chainId` | `undefined` \| `number` | - | | `speed` | [`TGasStationSpeed`](Hooks.md#tgasstationspeed) | | | `currentNetworkInfo?` | [`TNetworkInfo`](Models.md#tnetworkinfo) | uses gasPrice as a fallback | +| `override` | [`TOverride`](Models.md#toverride) | - | +| `options` | [`TUpdateOptions`](Models.md#tupdateoptions) | - | #### Returns -`undefined` \| `number` +[gasPrice: number, update: Function] gas as gwei #### Defined in -[src/hooks/useGasPrice.ts:39](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/hooks/useGasPrice.ts#L39) +[src/hooks/useGasPrice.ts:48](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/hooks/useGasPrice.ts#L48) ___ -### useGetUserFromProviders +### useNonce -▸ `Const` **useGetUserFromProviders**(`currentProvider`, ...`moreProviders`): [`TEthersUser`](Models.md#tethersuser) +▸ `Const` **useNonce**(`address`, `override?`, `options?`): [nonce: number, update: Function] #### Summary -Gets the user [TEthersUser](Models.md#tethersuser) from from the current provider or array of fallback providers +Get the current nonce for the address provided #### Notes -- 🤚🏽 Consider using the context provider [ethersProvider](../interfaces/EthersContext.IEthersContext.md#ethersprovider) +- updates triggered by [BlockNumberContext](EthersContext.md#blocknumbercontext) +- uses the current provider {@link ethersProvider} from [useEthersContext](EthersContext.md#useetherscontext) #### Parameters | Name | Type | | :------ | :------ | -| `currentProvider` | `undefined` \| [`TEthersProvider`](Models.md#tethersprovider) | -| `...moreProviders` | [`TEthersProvider`](Models.md#tethersprovider)[] | +| `address` | `undefined` \| `string` | +| `override` | [`TOverride`](Models.md#toverride) | +| `options` | [`TUpdateOptions`](Models.md#tupdateoptions) | #### Returns -[`TEthersUser`](Models.md#tethersuser) +[nonce: number, update: Function] #### Defined in -[src/hooks/useGetUserFromProviders.ts:21](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/hooks/useGetUserFromProviders.ts#L21) +[src/hooks/useNonce.ts:33](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/hooks/useNonce.ts#L33) ___ -### useGetUserFromSigners +### useSignerAddress -▸ `Const` **useGetUserFromSigners**(`signer`): [`TEthersUser`](Models.md#tethersuser) +▸ `Const` **useSignerAddress**(`signer`): [address: string, update: Function] #### Summary -Gets the user [TEthersUser](Models.md#tethersuser) for a signer or wallet +Get the address from the signer #### Parameters | Name | Type | | :------ | :------ | -| `signer` | `undefined` \| `Signer` \| `Wallet` | +| `signer` | `undefined` \| [`TEthersSigner`](Models.md#tetherssigner) | #### Returns -[`TEthersUser`](Models.md#tethersuser) +[address: string, update: Function] #### Defined in -[src/hooks/useGetUserFromSigners.ts:16](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/hooks/useGetUserFromSigners.ts#L16) +[src/hooks/useSignerAddress.ts:19](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/hooks/useSignerAddress.ts#L19) ___ -### useNonce +### useSignerChainId -▸ `Const` **useNonce**(`address`): `number` +▸ `Const` **useSignerChainId**(`signer`, `options?`): [address: number, update: Function] #### Summary -Get the current nonce for the address provided - -#### Notes -- updates triggered by [BlockNumberContext](EthersContext.md#blocknumbercontext) -- uses the current provider [ethersProvider](../interfaces/EthersContext.IEthersContext.md#ethersprovider) from [useEthersContext](EthersContext.md#useetherscontext) +Get the address from the signer #### Parameters | Name | Type | | :------ | :------ | -| `address` | `string` | - -#### Returns - -`number` - -#### Defined in - -[src/hooks/useNonce.ts:19](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/hooks/useNonce.ts#L19) - -___ - -### useOnRepetition - -▸ `Const` **useOnRepetition**(`callback`, `options`, ...`args`): `void` - -#### Summary -A hook that will periodically invoke a callback. -It can use one of the two options to do so -- onBlock: the block event is used to invoke callback -- Polling: invoke the callback periodically via polling. The minimum time is 10s. - -#### Notes -The callback can be invoked once on leading edge when leadTrigger conditions are satisfied -- For example you may want to wait for the provider to initalize before first invocation. -- 👩🏽‍🏫 A provider is needed for onBlock. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `callback` | (...`_args`: `any`[]) => `void` \| `Promise`<`void`\> | | -| `options` | `IUseOnRepetitionOptions` | | -| `...args` | `any`[] | variable arguments for callback | +| `signer` | `undefined` \| [`TEthersSigner`](Models.md#tetherssigner) | +| `options` | [`TUpdateOptions`](Models.md#tupdateoptions) | #### Returns -`void` +[address: number, update: Function] #### Defined in -[src/hooks/useOnRepetition.ts:43](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/hooks/useOnRepetition.ts#L43) +[src/hooks/useSignerChainId.ts:20](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/hooks/useSignerChainId.ts#L20) ___ ### useTimestamp -▸ `Const` **useTimestamp**(): `number` +▸ `Const` **useTimestamp**(`override?`, `options?`): [timestamp: number, update: Function] #### Summary Get the current timestamp from the latest block #### Notes - updates triggered by [BlockNumberContext](EthersContext.md#blocknumbercontext) -- uses the current provider [ethersProvider](../interfaces/EthersContext.IEthersContext.md#ethersprovider) from [useEthersContext](EthersContext.md#useetherscontext) +- uses the current provider {@link ethersProvider} from [useEthersContext](EthersContext.md#useetherscontext) + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `override` | [`TOverride`](Models.md#toverride) | +| `options` | [`TUpdateOptions`](Models.md#tupdateoptions) | #### Returns -`number` +[timestamp: number, update: Function] #### Defined in -[src/hooks/useTimestamp.ts:19](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/hooks/useTimestamp.ts#L19) +[src/hooks/useTimestamp.ts:30](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/hooks/useTimestamp.ts#L30) ___ -### useUserAddress +## Misc Functions -▸ `Const` **useUserAddress**(`signer`): `undefined` \| `string` +### parseContractsInJson -#### Summary -Get the address from the signer +▸ `Const` **parseContractsInJson**(`contractList`, `chainId`): `Record`<`string`, [`TBasicContractData`](Models.md#tbasiccontractdata)\> #### Parameters | Name | Type | | :------ | :------ | -| `signer` | `undefined` \| [`TEthersSigner`](Models.md#tetherssigner) | +| `contractList` | [`TDeployedHardhatContractsJson`](Models.md#tdeployedhardhatcontractsjson) | +| `chainId` | `number` | #### Returns -`undefined` \| `string` +`Record`<`string`, [`TBasicContractData`](Models.md#tbasiccontractdata)\> #### Defined in -[src/hooks/useUserAddress.ts:17](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/hooks/useUserAddress.ts#L17) +[src/hooks/useContractLoader.ts:59](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/hooks/useContractLoader.ts#L59) ___ -### useWeb3Modal +### useContractReader -▸ `Const` **useWeb3Modal**(`web3ModalConfig`, `setCurrentEthersProvider`): [`TWeb3ModalState`](Hooks.md#tweb3modalstate) +▸ `Const` **useContractReader**<`GContract`, `GContractFunc`\>(`contract`, `contractFunc`, `args?`, `funcEventFilter?`, `options?`): [value: Awaited\>, update: Function] #### Summary -A hook that makes it easy to interact and use [web3Modal](https://github.com/Web3Modal/web3modal) -- provides callback to open, logout and update the modal theme +Enables you to call a contract function with arguments and receive the output. You can use this to easily track of contract outputs in react states #### Notes -- 🤚🏽 Consider using the context provider [ethersProvider](../interfaces/EthersContext.IEthersContext.md#ethersprovider) and [EthersModalConnector](../classes/EthersContext.EthersModalConnector.md) instead. +- uses the ethers.Contract object's provider to access the network +- formatter is a function that can change the format of the output -#### Parameters +#### Type parameters | Name | Type | | :------ | :------ | -| `web3ModalConfig` | `Partial`<`ICoreOptions`\> | -| `setCurrentEthersProvider` | (`newEthersProvider`: `undefined` \| [`TEthersProvider`](Models.md#tethersprovider)) => `void` | - -#### Returns - -[`TWeb3ModalState`](Hooks.md#tweb3modalstate) - -#### Defined in - -[src/hooks/useWeb3Modal.ts:47](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/hooks/useWeb3Modal.ts#L47) - -___ - -## Misc Functions - -### parseContractsInJson - -▸ `Const` **parseContractsInJson**(`contractList`, `chainId`): `Record`<`string`, [`THardhatContractJson`](Models.md#thardhatcontractjson)\> +| `GContract` | extends `BaseContract`<`GContract`\> | +| `GContractFunc` | extends (...`args`: `any`[]) => `Promise`<`any`\> | #### Parameters | Name | Type | | :------ | :------ | -| `contractList` | [`TDeployedContractsJson`](Models.md#tdeployedcontractsjson) | -| `chainId` | `number` | +| `contract` | `undefined` \| `GContract` | +| `contractFunc` | `undefined` \| `GContractFunc` | +| `args?` | `Parameters`<`GContractFunc`\> | +| `funcEventFilter?` | `EventFilter` | +| `options` | [`TUpdateOptions`](Models.md#tupdateoptions) | #### Returns -`Record`<`string`, [`THardhatContractJson`](Models.md#thardhatcontractjson)\> +[value: Awaited\>, update: Function] #### Defined in -[src/hooks/useContractLoader.ts:14](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/hooks/useContractLoader.ts#L14) +[src/hooks/useContractReader.ts:27](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/hooks/useContractReader.ts#L27) ## Hooks Type aliases @@ -659,7 +698,7 @@ Return type of useBurnerSigner: #### Defined in -[src/hooks/useBurnerSigner.ts:56](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/hooks/useBurnerSigner.ts#L56) +[src/hooks/useBurnerSigner.ts:56](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/hooks/useBurnerSigner.ts#L56) ___ @@ -675,25 +714,28 @@ Preset speeds for Eth Gas Station API #### Defined in -[src/hooks/useGasPrice.ts:19](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/hooks/useGasPrice.ts#L19) +[src/hooks/useGasPrice.ts:28](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/hooks/useGasPrice.ts#L28) ___ -### TWeb3ModalState +## Models Type aliases -Ƭ **TWeb3ModalState**: `Object` +### TContractLoaderConfig -The current state of Web3Modal +Ƭ **TContractLoaderConfig**: `Object` + +#### Summary +Configuration for useContractLoader #### Type declaration | Name | Type | Description | | :------ | :------ | :------ | -| `initializing` | `boolean` | Is the modal initalizing | -| `openWeb3ModalCallback` | () => `void` | - | -| `logoutOfWeb3ModalCallback` | () => `void` | - | -| `updateWeb3ModalThemeCallback` | (`theme`: `string` \| `ThemeColors`) => `void` | - | +| `hardhatNetworkName?` | `string` | your local hardhat network name | +| `customAddresses?` | `Record`<`string`, `string`\> | the address:contractName key value pair | +| `deployedContractsJson?` | [`TDeployedHardhatContractsJson`](Models.md#tdeployedhardhatcontractsjson) | Hardhat deployed contracts untyped | +| `externalContracts?` | `TExternalContracts` | External contracts (such as DAI) | #### Defined in -[src/hooks/useWeb3Modal.ts:15](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/hooks/useWeb3Modal.ts#L15) +[src/hooks/useContractLoader.ts:39](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/hooks/useContractLoader.ts#L39) diff --git a/docs/api-typedocs/modules/Models.md b/docs/api-typedocs/modules/Models.md index b2eed204..a86f2579 100644 --- a/docs/api-typedocs/modules/Models.md +++ b/docs/api-typedocs/modules/Models.md @@ -1,4 +1,4 @@ -[eth-hooks - v3.4.0](../README.md) / Models +[eth-hooks - v4.0.8](../README.md) / Models # Module: Models @@ -6,91 +6,198 @@ Types and constants to make it easier to interact with ethers. ## Table of contents -### Interfaces +### Variables -- [IContractFactoryBridge](../interfaces/Models.IContractFactoryBridge.md) -- [TypedEvent](../interfaces/Models.TypedEvent.md) +- [const\_web3DialogClosedByUser](Models.md#const_web3dialogclosedbyuser) +- [keyNamespace](Models.md#keynamespace) +- [const\_blockNumberIntervalShort](Models.md#const_blocknumberintervalshort) +- [const\_blockNumberIntervalMedium](Models.md#const_blocknumberintervalmedium) +- [const\_blockNumberIntervalLong](Models.md#const_blocknumberintervallong) + +### EthersContext Type aliases + +- [TCreateEthersModalConnector](Models.md#tcreateethersmodalconnector) ### Models Type aliases -- [TDeployedContractsJson](Models.md#tdeployedcontractsjson) -- [TDeployedContractHelper](Models.md#tdeployedcontracthelper) -- [TExternalContracts](Models.md#texternalcontracts) +- [TDeployedHardhatContractsJson](Models.md#tdeployedhardhatcontractsjson) +- [TExternalContractsAddressMap](Models.md#texternalcontractsaddressmap) - [TContractFunctionInfo](Models.md#tcontractfunctioninfo) -- [TContractLoaderConfig](Models.md#tcontractloaderconfig) - [TNetworkInfo](Models.md#tnetworkinfo) +- [TEthersProvider](Models.md#tethersprovider) +- [TEthersProviderOrSigner](Models.md#tethersproviderorsigner) +- [TEthersSigner](Models.md#tetherssigner) +- [TAbstractProvider](Models.md#tabstractprovider) +- [TypedEventFilter](Models.md#typedeventfilter) +- [TypedEvent](Models.md#typedevent) +- [DeepPartial](Models.md#deeppartial) ### Misc Type aliases -- [THardhatContractJson](Models.md#thardhatcontractjson) +- [TConnectorConnectorBase](Models.md#tconnectorconnectorbase) +- [TContractConnector](Models.md#tcontractconnector) +- [TConnectorList](Models.md#tconnectorlist) +- [TTypedContract](Models.md#ttypedcontract) +- [TContractsByName](Models.md#tcontractsbyname) +- [TContractsByChainId](Models.md#tcontractsbychainid) +- [TAppContractsContext](Models.md#tappcontractscontext) +- [TBasicContractData](Models.md#tbasiccontractdata) +- [TBasicContractDataRecord](Models.md#tbasiccontractdatarecord) +- [TUpdateOptions](Models.md#tupdateoptions) +- [TOverride](Models.md#toverride) ### Type Definition Type aliases -- [TEthersProvider](Models.md#tethersprovider) -- [TEthersProviderOrSigner](Models.md#tethersproviderorsigner) -- [TEthersSigner](Models.md#tetherssigner) -- [TAbstractProvider](Models.md#tabstractprovider) -- [TEthersUser](Models.md#tethersuser) +- [TEthersAdaptor](Models.md#tethersadaptor) -## Models Type aliases +### EthersContext Interfaces + +- [IEthersContext](../interfaces/Models.IEthersContext.md) + +### Functions + +- [defaultOverride](Models.md#defaultoverride) +- [defaultUpdateOptions](Models.md#defaultupdateoptions) + +## Variables -### TDeployedContractsJson +### const\_web3DialogClosedByUser -Ƭ **TDeployedContractsJson**: `Object` +• **const\_web3DialogClosedByUser**: ``"Modal closed by user"`` + +#### Defined in + +[src/models/constants/common.ts:1](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/models/constants/common.ts#L1) + +___ + +### keyNamespace + +• **keyNamespace**: `Object` + +#### Type declaration + +| Name | Type | +| :------ | :------ | +| `network` | ``"network"`` | +| `signer` | ``"signer"`` | +| `contracts` | ``"contracts"`` | +| `state` | ``"state"`` | + +#### Defined in + +[src/models/constants/keyNamespace.ts:1](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/models/constants/keyNamespace.ts#L1) + +___ + +### const\_blockNumberIntervalShort + +• **const\_blockNumberIntervalShort**: [`DeepPartial`](Models.md#deeppartial)<[`TUpdateOptions`](Models.md#tupdateoptions)\> #### Summary -Contracts deployed by hardhat -- {chainIds: { networkNames: {contracts} }}, contains an record of contracts -- Used by [useContractLoader](Hooks.md#usecontractloader) +An constant for block number interval of 10 blocks -#### Index signature +#### Defined in + +[src/models/hookOptions.ts:9](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/models/hookOptions.ts#L9) -▪ [chainId: `string`]: { [networkName: string]: { `name`: `string` ; `chainId`: `string` ; `contracts`: { [contractName: string]: [`THardhatContractJson`](Models.md#thardhatcontractjson); } }; } +___ + +### const\_blockNumberIntervalMedium + +• **const\_blockNumberIntervalMedium**: [`DeepPartial`](Models.md#deeppartial)<[`TUpdateOptions`](Models.md#tupdateoptions)\> + +#### Summary +An constant for block number interval of 50 blocks #### Defined in -[src/models/contractTypes.ts:29](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/models/contractTypes.ts#L29) +[src/models/hookOptions.ts:15](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/models/hookOptions.ts#L15) ___ -### TDeployedContractHelper +### const\_blockNumberIntervalLong -Ƭ **TDeployedContractHelper**: `Object` +• **const\_blockNumberIntervalLong**: [`DeepPartial`](Models.md#deeppartial)<[`TUpdateOptions`](Models.md#tupdateoptions)\> #### Summary -Contract factories for contracts deployed by hardhat -- contractName: ethers.ContractFactory -- Used by [useContractLoader](Hooks.md#usecontractloader) +An constant for block number interval of 250 blocks + +#### Defined in + +[src/models/hookOptions.ts:21](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/models/hookOptions.ts#L21) + +## EthersContext Type aliases + +### TCreateEthersModalConnector + +Ƭ **TCreateEthersModalConnector**: (`id?`: `string`) => [`TEthersModalConnector`](EthersContext.md#tethersmodalconnector) \| `undefined` #### Type declaration +▸ (`id?`): [`TEthersModalConnector`](EthersContext.md#tethersmodalconnector) \| `undefined` + +#### Summary +A callback type that returns a EthersModalConnector + +#### Notes +- can be used by components that need to give a connector to [IEthersContext.openModal](../interfaces/Models.IEthersContext.md#openmodal) +- id is the identifier of the provider: [See docs](https://github.com/Web3Modal/web3modal#connect-to-specific-provider) + +##### Parameters + | Name | Type | | :------ | :------ | -| `factoryBridge` | `Object` | -| `contractList` | `Object` | +| `id?` | `string` | + +##### Returns + +[`TEthersModalConnector`](EthersContext.md#tethersmodalconnector) \| `undefined` #### Defined in -[src/models/contractTypes.ts:47](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/models/contractTypes.ts#L47) +[src/models/ethersAppContextTypes.ts:17](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/models/ethersAppContextTypes.ts#L17) ___ -### TExternalContracts +## Models Type aliases + +### TDeployedHardhatContractsJson -Ƭ **TExternalContracts**: `Object` +Ƭ **TDeployedHardhatContractsJson**: `Object` #### Summary -A type for external contracts -- {chainId: {contracts}}, contains an record of contracts +Describes the structure of hardhat_contracts.json +- {chainIds: { networkNames: {contracts} }}, contains an record of contracts - Used by [useContractLoader](Hooks.md#usecontractloader) #### Index signature -▪ [chainId: `number`]: { `name?`: `string` ; `chainId?`: `string` ; `contracts?`: { [contractName: string]: [`THardhatContractJson`](Models.md#thardhatcontractjson); } } +▪ [chainId: `string`]: { [networkName: string]: { `name`: `string` ; `chainId`: `string` ; `contracts`: { [contractName: string]: { `address`: `string` ; `abi?`: `any`[] }; } }; } #### Defined in -[src/models/contractTypes.ts:62](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/models/contractTypes.ts#L62) +[src/models/contractTypes.ts:30](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/models/contractTypes.ts#L30) + +___ + +### TExternalContractsAddressMap + +Ƭ **TExternalContractsAddressMap**: `Object` + +{chainId: {contract: address}}, contains an record of contracts +#### Summary +A type for external contracts +- it is a record of contract names and their deployed address +- this data type is used by {@link ContractsAppContext} to connect to external contracts + +#### Index signature + +▪ [chainId: `number`]: { [contractName: string]: `string`; } + +#### Defined in + +[src/models/contractTypes.ts:54](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/models/contractTypes.ts#L54) ___ @@ -114,154 +221,434 @@ Contract function information: #### Defined in -[src/models/contractTypes.ts:79](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/models/contractTypes.ts#L79) +[src/models/contractTypes.ts:69](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/models/contractTypes.ts#L69) ___ -### TContractLoaderConfig +### TNetworkInfo -Ƭ **TContractLoaderConfig**: `Object` +Ƭ **TNetworkInfo**: `Object` #### Summary -Configuration for useContractLoader +A type that describes the basics of a network for applications. e.g. mainnet, ropsten, rinkeby, etc. #### Type declaration -| Name | Type | Description | -| :------ | :------ | :------ | -| `hardhatNetworkName?` | `string` | your local hardhat network name | -| `customAddresses?` | `Record`<`string`, `string`\> | the address:contractName key value pair | -| `deployedContractsJson?` | [`TDeployedContractsJson`](Models.md#tdeployedcontractsjson) | Hardhat deployed contracts untyped and should be @deprecated | -| `deployedContractHelper?` | [`TDeployedContractHelper`](Models.md#tdeployedcontracthelper) | ⚠ in progress... not used currently Harhard deployed contract with TypeChain typings Contracts are created via contract factories | -| `externalContracts?` | [`TExternalContracts`](Models.md#texternalcontracts) | External contracts (such as DAI) | +| Name | Type | +| :------ | :------ | +| `name` | `string` | +| `color` | `string` | +| `chainId` | `number` | +| `rpcUrl` | `string` | +| `faucet?` | `string` | +| `blockExplorer` | `string` | +| `price?` | `number` | +| `gasPrice?` | `number` | #### Defined in -[src/models/contractTypes.ts:91](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/models/contractTypes.ts#L91) +[src/models/networkTypes.ts:7](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/models/networkTypes.ts#L7) ___ -### TNetworkInfo +### TEthersProvider -Ƭ **TNetworkInfo**: `Object` +Ƭ **TEthersProvider**: `JsonRpcProvider` \| `Web3Provider` \| `StaticJsonRpcProvider` #### Summary -A type that describes a network for applications +A union of various ethers providers for ease of use and maximum flexiblity -#### Type declaration +#### Notes +Used by eth-hooks, eth-components and scaffold-eth-typescript + +#### Defined in + +[src/models/providerTypes.ts:19](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/models/providerTypes.ts#L19) + +___ + +### TEthersProviderOrSigner + +Ƭ **TEthersProviderOrSigner**: `JsonRpcProvider` \| `Web3Provider` \| `StaticJsonRpcProvider` \| `Signer` \| `JsonRpcSigner` \| `Wallet` \| `VoidSigner` + +#### Summary +A union of various providers and signers in ethers to give maximum flexibility + +#### Defined in + +[src/models/providerTypes.ts:27](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/models/providerTypes.ts#L27) + +___ + +### TEthersSigner + +Ƭ **TEthersSigner**: `Signer` \| `JsonRpcSigner` \| `Wallet` \| `VoidSigner` + +#### Summary +A union of various providers in ethers to give maximum flexibility + +#### Defined in + +[src/models/providerTypes.ts:42](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/models/providerTypes.ts#L42) + +___ + +### TAbstractProvider + +Ƭ **TAbstractProvider**: `Provider` + +#### Summary +A union of abstract, non initalizable providers, used by some functions + +#### Defined in + +[src/models/providerTypes.ts:50](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/models/providerTypes.ts#L50) + +___ + +### TypedEventFilter + +Ƭ **TypedEventFilter**<`_EventArgsArray`, `_EventArgsObject`\>: `EventFilter` + +#### Summary +An generic extension of EventFilter that is used by TypedEvent. It allows for typed events to be returned + +#### Type parameters | Name | Type | | :------ | :------ | -| `name` | `string` | -| `color` | `string` | -| `chainId` | `number` | -| `rpcUrl` | `string` | -| `faucet?` | `string` | -| `blockExplorer` | `string` | -| `price?` | `number` | -| `gasPrice?` | `number` | +| `_EventArgsArray` | extends `any`[] | +| `_EventArgsObject` | extends `Record`<`string`, `any`\> | #### Defined in -[src/models/networkTypes.ts:7](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/models/networkTypes.ts#L7) +[src/models/providerTypes.ts:58](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/models/providerTypes.ts#L58) ___ -## Misc Type aliases +### TypedEvent + +Ƭ **TypedEvent**<`EventArgs`\>: `Event` & { `args`: `EventArgs` } + +#### Summary +An generic extension of Event. It types the the arguments and return values of the contract event to be used in typescript. + +#### Type parameters + +| Name | Type | +| :------ | :------ | +| `EventArgs` | extends `Result` | + +#### Defined in + +[src/models/providerTypes.ts:69](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/models/providerTypes.ts#L69) + +___ -### THardhatContractJson +### DeepPartial -Ƭ **THardhatContractJson**: `Object` +Ƭ **DeepPartial**<`T`\>: { [P in keyof T]?: DeepPartial } #### Summary -describes the sctructure of a contract in hardhat_contracts.json +Similar to [partial](https://www.typescriptlang.org/docs/handbook/utility-types.html#partialtype) int typescript but allows deep partial types. + +#### Type parameters + +| Name | +| :------ | +| `T` | + +#### Defined in + +[src/models/utilityTypes.ts:7](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/models/utilityTypes.ts#L7) + +___ + +## Misc Type aliases + +### TConnectorConnectorBase + +Ƭ **TConnectorConnectorBase**<`GContract`, `GContractInterface`\>: `Object` + +#### Type parameters + +| Name | Type | +| :------ | :------ | +| `GContract` | extends `BaseContract` | +| `GContractInterface` | extends `ethers.utils.Interface` | #### Type declaration | Name | Type | | :------ | :------ | -| `address` | `string` | -| `abi` | `any`[] | +| `connect` | (`address`: `string`, `signerOrProvider`: `Signer` \| `Provider`) => `GContract` | +| `createInterface` | () => `GContractInterface` | +| `abi` | `Record`<`string`, `any`\>[] | #### Defined in -[src/models/contractTypes.ts:16](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/models/contractTypes.ts#L16) +[src/models/contractContextTypes.ts:4](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/models/contractContextTypes.ts#L4) ___ -## Type Definition Type aliases +### TContractConnector -### TEthersProvider +Ƭ **TContractConnector**<`GContractNames`, `GContract`, `GContractInterface`\>: { `contractName`: `GContractNames` ; `config`: { [chainId: number]: { `address`: `string` }; } } & [`TConnectorConnectorBase`](Models.md#tconnectorconnectorbase)<`GContract`, `GContractInterface`\> -Ƭ **TEthersProvider**: `JsonRpcProvider` \| `Web3Provider` \| `StaticJsonRpcProvider` +#### Type parameters + +| Name | Type | +| :------ | :------ | +| `GContractNames` | extends `string` | +| `GContract` | extends `BaseContract` | +| `GContractInterface` | extends `ethers.utils.Interface` | + +#### Defined in + +[src/models/contractContextTypes.ts:13](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/models/contractContextTypes.ts#L13) + +___ + +### TConnectorList + +Ƭ **TConnectorList**<`GContactNames`\>: { [contractName in GContactNames]: TContractConnector } + +#### Type parameters + +| Name | Type | +| :------ | :------ | +| `GContactNames` | extends `string` | + +#### Defined in + +[src/models/contractContextTypes.ts:24](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/models/contractContextTypes.ts#L24) + +___ + +### TTypedContract + +Ƭ **TTypedContract**<`GContractNames`, `GAppContractConnectorList`\>: `GAppContractConnectorList` extends { [key in GContractNames]: Object } ? `TypedContract` : `BaseContract` + +#### Type parameters + +| Name | Type | +| :------ | :------ | +| `GContractNames` | extends `string` | +| `GAppContractConnectorList` | `GAppContractConnectorList` | + +#### Defined in + +[src/models/contractContextTypes.ts:28](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/models/contractContextTypes.ts#L28) + +___ + +### TContractsByName + +Ƭ **TContractsByName**<`GContractNames`\>: `Record`<`GContractNames`, { [chainId: number]: `BaseContract` \| `undefined`; }\> + +#### Type parameters + +| Name | Type | +| :------ | :------ | +| `GContractNames` | extends `string` | + +#### Defined in + +[src/models/contractContextTypes.ts:37](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/models/contractContextTypes.ts#L37) + +___ + +### TContractsByChainId + +Ƭ **TContractsByChainId**<`GContractNames`\>: `Record`<`number`, { [contractName in GContractNames]: BaseContract \| undefined }\> + +#### Type parameters + +| Name | Type | +| :------ | :------ | +| `GContractNames` | extends `string` | + +#### Defined in + +[src/models/contractContextTypes.ts:42](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/models/contractContextTypes.ts#L42) + +___ + +### TAppContractsContext + +Ƭ **TAppContractsContext**<`GContractNames`\>: `Object` + +#### Type parameters + +| Name | Type | +| :------ | :------ | +| `GContractNames` | extends `string` | + +#### Type declaration + +| Name | Type | +| :------ | :------ | +| `contractConnectors` | [`TConnectorList`](Models.md#tconnectorlist)<`GContractNames`\> | +| `contractsByName` | [`TContractsByName`](Models.md#tcontractsbyname)<`GContractNames`\> | +| `contractsByChainId` | [`TContractsByChainId`](Models.md#tcontractsbychainid)<`GContractNames`\> | + +#### Defined in + +[src/models/contractContextTypes.ts:50](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/models/contractContextTypes.ts#L50) + +___ + +### TBasicContractData + +Ƭ **TBasicContractData**: `Object` #### Summary -A union of various ethers providers for ease of use and maximum flexiblity +Describes the sctructure of each contract in hardhat_contracts.json -#### Notes -Used by eth-hooks, eth-components and scaffold-eth-typescript +#### Type declaration + +| Name | Type | +| :------ | :------ | +| `address` | `string` | +| `abi?` | `any`[] | #### Defined in -[src/models/providerTypes.ts:19](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/models/providerTypes.ts#L19) +[src/models/contractTypes.ts:5](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/models/contractTypes.ts#L5) ___ -### TEthersProviderOrSigner +### TBasicContractDataRecord -Ƭ **TEthersProviderOrSigner**: `JsonRpcProvider` \| `Web3Provider` \| `StaticJsonRpcProvider` \| `Signer` \| `JsonRpcSigner` \| `Wallet` \| `VoidSigner` +Ƭ **TBasicContractDataRecord**: `Object` #### Summary -A union of various providers and signers in ethers to give maximum flexibility +Contracts by contract name +- A record of contract names and their hardhat contract json +- includes chain id + +#### Index signature + +▪ [contractName: `string`]: [`TBasicContractData`](Models.md#tbasiccontractdata) & { `chainId`: `number` } #### Defined in -[src/models/providerTypes.ts:27](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/models/providerTypes.ts#L27) +[src/models/contractTypes.ts:16](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/models/contractTypes.ts#L16) ___ -### TEthersSigner +### TUpdateOptions -Ƭ **TEthersSigner**: `Signer` \| `JsonRpcSigner` \| `Wallet` \| `VoidSigner` +Ƭ **TUpdateOptions**: `Object` #### Summary -A union of various providers in ethers to give maximum flexibility +Options for hooks that describe the behviour of updates. +By default, depending on the hook, it will update every block. + +#### Notes +The following options are available: +- interval: interval in blocknumber to update in (default 1) see {@link TUpdateOptions.blockNumberInterval} +- polling: in ms, should be over 10000ms. This is set by {@link TUpdateOptions.query.refetchInterval} + +#### Type declaration + +| Name | Type | Description | +| :------ | :------ | :------ | +| `blockNumberInterval` | `number` | The interval in blocknumber for the hook to update in (default 1) | +| `query` | `Object` | react query options | +| `query.refetchOnWindowFocus` | `boolean` | update when window comes into focus (default: false) | +| `query.refetchOnMount` | `boolean` | update on mount of component (default: true) | +| `query.staleTime` | `number` | consider the data stale after this time (default: 30s) | +| `query.refetchInterval` | `number` \| `undefined` | polling interval in ms (default: undefined) if you set this, this will turn of blockNumberInterval option | #### Defined in -[src/models/providerTypes.ts:42](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/models/providerTypes.ts#L42) +[src/models/hookOptions.ts:33](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/models/hookOptions.ts#L33) ___ -### TAbstractProvider +### TOverride -Ƭ **TAbstractProvider**: `Provider` +Ƭ **TOverride**: `Object` #### Summary -A union of abstract, non initalizable providers, used by some functions +Ethers Provider options. By default, the context provider is used by the hook. If you want to use a different provider, you can: +- pass in an [TEthersAdaptor](Models.md#tethersadaptor) to override the provider +- give the alternateContextKey for a secondary context provider. + +#### Notes +Adaptor +- To create a adaptor from a provider/signer see {@link useGetEthersAdaptorFromSignerOrProvider} +- You need to set adaptorEnabled to true + +Alternate Context Key +- For more info on alternateContextKey, see [TEthersAppContextProps](EthersContext.md#tethersappcontextprops) and [web3-react docs](https://github.com/NoahZinsmeister/web3-react/tree/v6/docs#createweb3reactroot). + +#### Type declaration + +| Name | Type | Description | +| :------ | :------ | :------ | +| `adaptorEnabled` | `boolean` | An enable override adaptor (ethers provider) for this hook | +| `adaptor` | [`TEthersAdaptor`](Models.md#tethersadaptor) \| `undefined` | The alternate adaptor to use. See [TEthersAdaptor](Models.md#tethersadaptor) | +| `alternateContextKey?` | `string` | The alternate context key to use. See [TEthersAppContextProps](EthersContext.md#tethersappcontextprops) | #### Defined in -[src/models/providerTypes.ts:50](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/models/providerTypes.ts#L50) +[src/models/hookOptions.ts:76](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/models/hookOptions.ts#L76) ___ -### TEthersUser +## Type Definition Type aliases + +### TEthersAdaptor -Ƭ **TEthersUser**: `Object` +Ƭ **TEthersAdaptor**: `Object` #### Summary -Essentially a provider and signer and network information for ease of use. +Essentially a object that allows interaction with the network: +- provider signer, #### Type declaration | Name | Type | | :------ | :------ | -| `signer` | `Signer` \| `undefined` | -| `provider` | [`TEthersProvider`](Models.md#tethersprovider) \| `undefined` | -| `providerNetwork` | `ethers.providers.Network` \| `undefined` | -| `address` | `string` \| `undefined` | +| `signer?` | [`TEthersSigner`](Models.md#tetherssigner) | +| `provider?` | [`TEthersProvider`](Models.md#tethersprovider) | +| `chainId?` | `number` | +| `account?` | `string` | + +#### Defined in + +[src/models/ethersAppContextTypes.ts:49](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/models/ethersAppContextTypes.ts#L49) + +## Functions + +### defaultOverride + +▸ `Const` **defaultOverride**(): [`TOverride`](Models.md#toverride) + +An helper to create the default override settings for hooks + +#### Returns + +[`TOverride`](Models.md#toverride) + +#### Defined in + +[src/models/hookOptions.ts:96](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/models/hookOptions.ts#L96) + +___ + +### defaultUpdateOptions + +▸ `Const` **defaultUpdateOptions**(): [`TUpdateOptions`](Models.md#tupdateoptions) + +A helper to create default update options for hooks + +#### Returns + +[`TUpdateOptions`](Models.md#tupdateoptions) #### Defined in -[src/models/providerTypes.ts:58](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/models/providerTypes.ts#L58) +[src/models/hookOptions.ts:108](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/models/hookOptions.ts#L108) diff --git a/docs/api-typedocs/modules/TestUtils.md b/docs/api-typedocs/modules/TestUtils.md index 5b946f0b..ab5659c2 100644 --- a/docs/api-typedocs/modules/TestUtils.md +++ b/docs/api-typedocs/modules/TestUtils.md @@ -1,4 +1,4 @@ -[eth-hooks - v3.4.0](../README.md) / TestUtils +[eth-hooks - v4.0.8](../README.md) / TestUtils # Module: TestUtils @@ -11,19 +11,27 @@ Utilities to write tests with ethers, waffle and react hooks - [const\_basicGasPrice](TestUtils.md#const_basicgasprice) - [const\_DefaultTestChainId](TestUtils.md#const_defaulttestchainid) - [defaultBlockWaitOptions](TestUtils.md#defaultblockwaitoptions) +- [TestAppWrapper](TestUtils.md#testappwrapper) ### Functions - [mineBlock](TestUtils.md#mineblock) - [fromGwei](TestUtils.md#fromgwei) - [fromEther](TestUtils.md#fromether) +- [expectValidWallets](TestUtils.md#expectvalidwallets) - [getMockProvider](TestUtils.md#getmockprovider) -- [hookTestHarness](TestUtils.md#hooktestharness) +- [wrapperTestSetupHelper](TestUtils.md#wrappertestsetuphelper) +- [currentTestBlockNumber](TestUtils.md#currenttestblocknumber) +- [hookTestWrapper](TestUtils.md#hooktestwrapper) - [isActive](TestUtils.md#isactive) - [waitForActivation](TestUtils.md#waitforactivation) - [getHardhatAccount](TestUtils.md#gethardhataccount) - [getHardhatSigner](TestUtils.md#gethardhatsigner) +### Classes + +- [MockConnector](../classes/TestUtils.MockConnector.md) + ### Type aliases - [TTestHookResult](TestUtils.md#ttesthookresult) @@ -36,7 +44,7 @@ Utilities to write tests with ethers, waffle and react hooks #### Defined in -[src/helpers/test-utils/constants/testConstants.ts:3](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/helpers/test-utils/constants/testConstants.ts#L3) +[src/helpers/test-utils/constants/testConstants.ts:3](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/helpers/test-utils/constants/testConstants.ts#L3) ___ @@ -46,7 +54,7 @@ ___ #### Defined in -[src/helpers/test-utils/constants/testConstants.ts:5](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/helpers/test-utils/constants/testConstants.ts#L5) +[src/helpers/test-utils/constants/testConstants.ts:5](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/helpers/test-utils/constants/testConstants.ts#L5) ___ @@ -56,7 +64,23 @@ ___ #### Defined in -[src/helpers/test-utils/constants/testConstants.ts:7](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/helpers/test-utils/constants/testConstants.ts#L7) +[src/helpers/test-utils/constants/testConstants.ts:7](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/helpers/test-utils/constants/testConstants.ts#L7) + +___ + +### TestAppWrapper + +• **TestAppWrapper**: `FC`<`IMockProps`\> + +This is a wrapper for tests + +**`param`** + +**`returns`** + +#### Defined in + +[src/helpers/test-utils/wrapper/TestAppWrapper.tsx:37](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/helpers/test-utils/wrapper/TestAppWrapper.tsx#L37) ## Functions @@ -76,7 +100,7 @@ ___ #### Defined in -[src/helpers/test-utils/eth/hardhatActions.ts:3](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/helpers/test-utils/eth/hardhatActions.ts#L3) +[src/helpers/test-utils/eth/hardhatActions.ts:3](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/helpers/test-utils/eth/hardhatActions.ts#L3) ___ @@ -96,7 +120,7 @@ ___ #### Defined in -[src/helpers/test-utils/functions/conversions.ts:3](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/helpers/test-utils/functions/conversions.ts#L3) +[src/helpers/test-utils/functions/conversions.ts:3](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/helpers/test-utils/functions/conversions.ts#L3) ___ @@ -116,7 +140,27 @@ ___ #### Defined in -[src/helpers/test-utils/functions/conversions.ts:7](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/helpers/test-utils/functions/conversions.ts#L7) +[src/helpers/test-utils/functions/conversions.ts:7](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/helpers/test-utils/functions/conversions.ts#L7) + +___ + +### expectValidWallets + +▸ `Const` **expectValidWallets**(...`wallets`): `void` + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `...wallets` | `Wallet`[] | + +#### Returns + +`void` + +#### Defined in + +[src/helpers/test-utils/functions/expect.ts:4](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/helpers/test-utils/functions/expect.ts#L4) ___ @@ -130,13 +174,41 @@ ___ #### Defined in -[src/helpers/test-utils/harness/getMockProvider.ts:6](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/helpers/test-utils/harness/getMockProvider.ts#L6) +[src/helpers/test-utils/wrapper/getMockProvider.ts:6](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/helpers/test-utils/wrapper/getMockProvider.ts#L6) ___ -### hookTestHarness +### wrapperTestSetupHelper + +▸ `Const` **wrapperTestSetupHelper**(): `Promise`<[`TTestHookResult`](TestUtils.md#ttesthookresult)<() => `number`\>\> + +#### Returns + +`Promise`<[`TTestHookResult`](TestUtils.md#ttesthookresult)<() => `number`\>\> + +#### Defined in -▸ `Const` **hookTestHarness**<`PropsT`, `ResultT`\>(`callbackToHook`): `Promise`<[`TTestHookResult`](TestUtils.md#ttesthookresult)<`PropsT`, `ResultT`\>\> +[src/helpers/test-utils/wrapper/hardhatTestHelpers.ts:4](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/helpers/test-utils/wrapper/hardhatTestHelpers.ts#L4) + +___ + +### currentTestBlockNumber + +▸ `Const` **currentTestBlockNumber**(): `Promise`<`number`\> + +#### Returns + +`Promise`<`number`\> + +#### Defined in + +[src/helpers/test-utils/wrapper/hardhatTestHelpers.ts:12](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/helpers/test-utils/wrapper/hardhatTestHelpers.ts#L12) + +___ + +### hookTestWrapper + +▸ `Const` **hookTestWrapper**<`TCallbackToHook`\>(`callbackToHook`): `Promise`<[`TTestHookResult`](TestUtils.md#ttesthookresult)<`TCallbackToHook`\>\> Created a test hook with a Web3Wrapper @@ -144,26 +216,25 @@ Created a test hook with a Web3Wrapper #### Type parameters -| Name | -| :------ | -| `PropsT` | -| `ResultT` | +| Name | Type | +| :------ | :------ | +| `TCallbackToHook` | extends (`input`: `any`) => `any` | #### Parameters | Name | Type | Description | | :------ | :------ | :------ | -| `callbackToHook` | (`input`: `PropsT`) => `ResultT` | callback to init hook | +| `callbackToHook` | `TCallbackToHook` | callback to init hook | #### Returns -`Promise`<[`TTestHookResult`](TestUtils.md#ttesthookresult)<`PropsT`, `ResultT`\>\> +`Promise`<[`TTestHookResult`](TestUtils.md#ttesthookresult)<`TCallbackToHook`\>\> (TTestHookResult) #### Defined in -[src/helpers/test-utils/harness/hookTestHarness.tsx:24](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/helpers/test-utils/harness/hookTestHarness.tsx#L24) +[src/helpers/test-utils/wrapper/testWrapper.tsx:28](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/helpers/test-utils/wrapper/testWrapper.tsx#L28) ___ @@ -175,7 +246,7 @@ ___ | Name | Type | | :------ | :------ | -| `connector` | `MockConnector` | +| `connector` | [`MockConnector`](../classes/TestUtils.MockConnector.md) | #### Returns @@ -183,7 +254,7 @@ ___ #### Defined in -[src/helpers/test-utils/harness/mockHelpers.ts:6](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/helpers/test-utils/harness/mockHelpers.ts#L6) +[src/helpers/test-utils/wrapper/wrapperHelpers.ts:6](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/helpers/test-utils/wrapper/wrapperHelpers.ts#L6) ___ @@ -203,7 +274,7 @@ ___ #### Defined in -[src/helpers/test-utils/harness/mockHelpers.ts:15](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/helpers/test-utils/harness/mockHelpers.ts#L15) +[src/helpers/test-utils/wrapper/wrapperHelpers.ts:15](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/helpers/test-utils/wrapper/wrapperHelpers.ts#L15) ___ @@ -224,7 +295,7 @@ ___ #### Defined in -[src/helpers/test-utils/harness/mockHelpers.ts:26](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/helpers/test-utils/harness/mockHelpers.ts#L26) +[src/helpers/test-utils/wrapper/wrapperHelpers.ts:26](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/helpers/test-utils/wrapper/wrapperHelpers.ts#L26) ___ @@ -245,21 +316,20 @@ ___ #### Defined in -[src/helpers/test-utils/harness/mockHelpers.ts:36](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/helpers/test-utils/harness/mockHelpers.ts#L36) +[src/helpers/test-utils/wrapper/wrapperHelpers.ts:36](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/helpers/test-utils/wrapper/wrapperHelpers.ts#L36) ## Type aliases ### TTestHookResult -Ƭ **TTestHookResult**<`PropsT`, `TResult`\>: `RenderHookResult`<`PropsT`, `TResult`, `Renderer`<`PropsT`\>\> & { `mockProvider`: `MockProvider` } +Ƭ **TTestHookResult**<`TCallbackToHook`\>: `Omit`<`RenderHookResult`<`Parameters`<`TCallbackToHook`\>, `ReturnType`<`TCallbackToHook`\>\>, ``"rerender"``\> & { `mockProvider`: `MockProvider` ; `rerender`: (`input`: `Parameters`<`TCallbackToHook`\>[``0``]) => `void` } #### Type parameters -| Name | -| :------ | -| `PropsT` | -| `TResult` | +| Name | Type | +| :------ | :------ | +| `TCallbackToHook` | extends (`input`: `any`) => `any` | #### Defined in -[src/helpers/test-utils/harness/hookTestHarness.tsx:12](https://github.com/scaffold-eth/eth-hooks/blob/2b71461/src/helpers/test-utils/harness/hookTestHarness.tsx#L12) +[src/helpers/test-utils/wrapper/testWrapper.tsx:14](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/helpers/test-utils/wrapper/testWrapper.tsx#L14) diff --git a/package.json b/package.json index e87c84c6..0a26cc7f 100644 --- a/package.json +++ b/package.json @@ -38,6 +38,7 @@ "docs": "yarn typedoc --listInvalidSymbolLinks && shx mv ./docs/api-typedocs/readme.md ./docs/api-typedocs/api-overview.md", "deprecate": "npm deprecate", "lint": "eslint --config ./.eslintrc --ignore-path ./.eslintignore ./src/**/*.(ts|tsx) ./test/**/*.(ts|tsx)", + "test": "yarn test:hardhat", "test:hardhat": "yarn hh:run test --network hardhat", "test:mocha": "yarn hh:env yarn mocha --config .mocharc.js", "hh:run": "yarn hh:env yarn hardhat", diff --git a/src/dapps.ts b/src/dapps.ts index 0f025ba5..80224e13 100644 --- a/src/dapps.ts +++ b/src/dapps.ts @@ -1 +1,5 @@ +/** + * @module Hooks + */ + export * from './hooks/dapps'; diff --git a/src/erc.ts b/src/erc.ts index 49905ec6..b1517375 100644 --- a/src/erc.ts +++ b/src/erc.ts @@ -1 +1,5 @@ +/** + * @module Hooks + */ + export * from './hooks/erc'; diff --git a/src/functions/hookOptionsHelpers.ts b/src/functions/hookOptionsHelpers.ts index 10afe0f8..6ee81cc7 100644 --- a/src/functions/hookOptionsHelpers.ts +++ b/src/functions/hookOptionsHelpers.ts @@ -35,7 +35,7 @@ export const checkUpdateOptions = (context: IEthersContext, update: TUpdateOptio 'Invalid refetchInterval (polling), must be at least 10000ms or undefined (disabled)' ); invariant( - update.blockNumberInterval == null, + update.blockNumberInterval === 1, 'You cannot use both refetchInterval (polling) and blockNumberInterval at the same time' ); } else { diff --git a/src/helpers/typedoc/hooks.docs.ts b/src/helpers/typedoc/hooks.docs.ts index 0e6bfb7e..eeab3e03 100644 --- a/src/helpers/typedoc/hooks.docs.ts +++ b/src/helpers/typedoc/hooks.docs.ts @@ -3,7 +3,8 @@ * * @module Hooks */ -// /////// + +// ////// export * from '../../hooks'; export * from '../../hooks/dapps'; diff --git a/src/hooks/useEventListener.ts b/src/hooks/useEventListener.ts index 392d4576..172af003 100644 --- a/src/hooks/useEventListener.ts +++ b/src/hooks/useEventListener.ts @@ -4,7 +4,7 @@ import { useEffect } from 'react'; import { useQuery } from 'react-query'; import { contractKey, mergeDefaultUpdateOptions, TRequiredKeys } from '~~/functions'; -import { const_blockNumberInterval100, TUpdateOptions, TypedEvent } from '~~/models'; +import { const_blockNumberIntervalMedium, TUpdateOptions, TypedEvent } from '~~/models'; import { keyNamespace } from '~~/models/constants'; const queryKey: TRequiredKeys = { namespace: keyNamespace.contracts, key: 'useEventListener' } as const; @@ -28,7 +28,7 @@ export const useEventListener = >( eventFilter: string | EventFilter | undefined, startBlock: number, toBlock: number | undefined = undefined, - options: TUpdateOptions = mergeDefaultUpdateOptions({ ...const_blockNumberInterval100 }) + options: TUpdateOptions = mergeDefaultUpdateOptions({ ...const_blockNumberIntervalMedium }) ): [eventMap: GTypedEvent[], queryEvents: () => void] => { const keys = [ { diff --git a/src/hooks/useSignerChainId.ts b/src/hooks/useSignerChainId.ts index 217b0a9a..1166fbbc 100644 --- a/src/hooks/useSignerChainId.ts +++ b/src/hooks/useSignerChainId.ts @@ -3,7 +3,7 @@ import { useQuery } from 'react-query'; import { useBlockNumberContext } from '~~/context'; import { mergeDefaultUpdateOptions, providerKey, TRequiredKeys } from '~~/functions'; import { useEthersUpdater } from '~~/hooks/useEthersUpdater'; -import { const_blockNumberInterval100, TEthersSigner, TUpdateOptions } from '~~/models'; +import { const_blockNumberIntervalMedium, TEthersSigner, TUpdateOptions } from '~~/models'; import { keyNamespace } from '~~/models/constants'; const queryKey: TRequiredKeys = { namespace: keyNamespace.signer, key: 'useSignerChainId' } as const; @@ -19,7 +19,7 @@ const queryKey: TRequiredKeys = { namespace: keyNamespace.signer, key: 'useSigne */ export const useSignerChainId = ( signer: TEthersSigner | undefined, - options: TUpdateOptions = mergeDefaultUpdateOptions({ ...const_blockNumberInterval100 }) + options: TUpdateOptions = mergeDefaultUpdateOptions({ ...const_blockNumberIntervalMedium }) ): [address: number | undefined, update: () => void] => { const keys = [{ ...queryKey, ...providerKey(signer) }] as const; const { data, refetch } = useQuery( diff --git a/src/models/hookOptions.ts b/src/models/hookOptions.ts index 4ed8abc2..1a961258 100644 --- a/src/models/hookOptions.ts +++ b/src/models/hookOptions.ts @@ -3,26 +3,96 @@ import { TEthersAdaptor } from './ethersAppContextTypes'; import { DeepPartial } from '~~/models/utilityTypes'; /** - * interval of 100 blocks + * #### Summary + * An constant for block number interval of 10 blocks */ -export const const_blockNumberInterval100: DeepPartial = { blockNumberInterval: 100 }; +export const const_blockNumberIntervalShort: DeepPartial = { blockNumberInterval: 10 }; +/** + * #### Summary + * An constant for block number interval of 50 blocks + */ +export const const_blockNumberIntervalMedium: DeepPartial = { blockNumberInterval: 50 }; + +/** + * #### Summary + * An constant for block number interval of 250 blocks + */ +export const const_blockNumberIntervalLong: DeepPartial = { blockNumberInterval: 250 }; + +/** + * #### Summary + * Options for hooks that describe the behviour of updates. + * By default, depending on the hook, it will update every block. + * + * #### Notes + * The following options are available: + * - interval: interval in blocknumber to update in (default 1) see {@link TUpdateOptions.blockNumberInterval} + * - polling: in ms, should be over 10000ms. This is set by {@link TUpdateOptions.query.refetchInterval} + */ export type TUpdateOptions = { + /** + * The interval in blocknumber for the hook to update in (default 1) + */ blockNumberInterval: number; + /** + * react query options + */ query: { + /** + * update when window comes into focus (default: false) + */ refetchOnWindowFocus: boolean; + /** + * update on mount of component (default: true) + */ refetchOnMount: boolean; + /** + * consider the data stale after this time (default: 30s) + */ staleTime: number; + /** + * polling interval in ms (default: undefined) + * if you set this, this will turn of blockNumberInterval option + */ refetchInterval: number | undefined; }; }; +/** + * #### Summary + * Ethers Provider options. By default, the context provider is used by the hook. If you want to use a different provider, you can: + * - pass in an {@link TEthersAdaptor} to override the provider + * - give the alternateContextKey for a secondary context provider. + * + * #### Notes + * Adaptor + * - To create a adaptor from a provider/signer see {@link useGetEthersAdaptorFromSignerOrProvider} + * - You need to set adaptorEnabled to true + * + * Alternate Context Key + * - For more info on alternateContextKey, see {@link TEthersAppContextProps} and [web3-react docs](https://github.com/NoahZinsmeister/web3-react/tree/v6/docs#createweb3reactroot). + */ export type TOverride = { + /** + * An enable override adaptor (ethers provider) for this hook + */ adaptorEnabled: boolean; + /** + * The alternate adaptor to use. See {@link TEthersAdaptor} + */ adaptor: TEthersAdaptor | undefined; + + /** + * The alternate context key to use. See {@link TEthersAppContextProps} + */ alternateContextKey?: string; }; +/** + * An helper to create the default override settings for hooks + * @returns {TOverride} + */ export const defaultOverride = (): TOverride => { return { adaptorEnabled: false, @@ -30,6 +100,11 @@ export const defaultOverride = (): TOverride => { alternateContextKey: undefined, }; }; + +/** + * A helper to create default update options for hooks + * @returns {TUpdateOptions} + */ export const defaultUpdateOptions = (): TUpdateOptions => { return { blockNumberInterval: 1, diff --git a/src/models/networkTypes.ts b/src/models/networkTypes.ts index 39a4737f..db94b6da 100644 --- a/src/models/networkTypes.ts +++ b/src/models/networkTypes.ts @@ -1,6 +1,6 @@ /** * #### Summary - * A type that describes a network for applications + * A type that describes the basics of a network for applications. e.g. mainnet, ropsten, rinkeby, etc. * * @category Models */ diff --git a/src/models/providerTypes.ts b/src/models/providerTypes.ts index 886635ef..97b91102 100644 --- a/src/models/providerTypes.ts +++ b/src/models/providerTypes.ts @@ -14,7 +14,7 @@ import { Result } from 'ethers/lib/utils'; * #### Notes * Used by eth-hooks, eth-components and scaffold-eth-typescript * - * @category Type Definition + * @category Models */ export type TEthersProvider = JsonRpcProvider | Web3Provider | StaticJsonRpcProvider; @@ -22,7 +22,7 @@ export type TEthersProvider = JsonRpcProvider | Web3Provider | StaticJsonRpcProv * #### Summary * A union of various providers and signers in ethers to give maximum flexibility * - * @category Type Definition + * @category Models */ export type TEthersProviderOrSigner = | JsonRpcProvider @@ -37,7 +37,7 @@ export type TEthersProviderOrSigner = * #### Summary * A union of various providers in ethers to give maximum flexibility * - * @category Type Definition + * @category Models */ export type TEthersSigner = Signer | JsonRpcSigner | Wallet | VoidSigner; @@ -45,21 +45,27 @@ export type TEthersSigner = Signer | JsonRpcSigner | Wallet | VoidSigner; * #### Summary * A union of abstract, non initalizable providers, used by some functions * - * @category Type Definition + * @category Models */ export type TAbstractProvider = Provider; +/** + * #### Summary + * An generic extension of EventFilter that is used by TypedEvent. It allows for typed events to be returned + * + * @category Models + */ export type TypedEventFilter< _EventArgsArray extends Array, _EventArgsObject extends Record > = EventFilter; +/** + * #### Summary + * An generic extension of Event. It types the the arguments and return values of the contract event to be used in typescript. + * + * @category Models + */ export type TypedEvent = Event & { args: EventArgs; }; - -export type TQueryFilter = , EventArgsObject>( - event: TypedEventFilter, - fromBlockOrBlockhash?: string | number | undefined, - toBlock?: string | number | undefined -) => Promise>>; diff --git a/src/models/utilityTypes.ts b/src/models/utilityTypes.ts index 4fff1889..a5d74532 100644 --- a/src/models/utilityTypes.ts +++ b/src/models/utilityTypes.ts @@ -1,3 +1,9 @@ +/** + * #### Summary + * Similar to [partial](https://www.typescriptlang.org/docs/handbook/utility-types.html#partialtype) int typescript but allows deep partial types. + * + * @category Models + */ export type DeepPartial = { [P in keyof T]?: DeepPartial; }; diff --git a/typedoc.json b/typedoc.json index 316a7a45..e36db555 100644 --- a/typedoc.json +++ b/typedoc.json @@ -18,5 +18,5 @@ "sort": ["source-order"], "excludePrivate": true, "excludeInternal": true, - "exclude": ["test/**/*", "**/*.test.ts", "**/*.test.tsx)"] + "exclude": ["hardhat.config.ts", "test/**/*", "test-files/**/*", "**/*.test.ts", "**/*.test.tsx)"] } From e894268589cd0d502f9e4ff2eaddd8b2068317c6 Mon Sep 17 00:00:00 2001 From: Shravan Sunder Date: Wed, 12 Jan 2022 20:27:14 -0500 Subject: [PATCH 03/21] #124 updated readme in docs --- README.md | 19 +----- docs/README.md | 24 ------- .../EthersContext.CouldNotActivateError.md | 2 +- .../EthersContext.EthersModalConnector.md | 50 +++++++-------- ...ersContext.NoEthereumProviderFoundError.md | 2 +- .../EthersContext.UserClosedModalError.md | 2 +- .../classes/TestUtils.MockConnector.md | 44 ++++++------- .../EthersContext.ICommonModalConnector.md | 10 +-- ....IStaticJsonRpcProviderConnectorOptions.md | 4 +- .../interfaces/Models.IEthersContext.md | 20 +++--- docs/api-typedocs/modules/EthersContext.md | 30 ++++----- docs/api-typedocs/modules/Helpers.md | 2 +- docs/api-typedocs/modules/Hooks.md | 48 +++++++------- docs/api-typedocs/modules/Models.md | 62 +++++++++---------- docs/api-typedocs/modules/TestUtils.md | 34 +++++----- 15 files changed, 158 insertions(+), 195 deletions(-) diff --git a/README.md b/README.md index 35694a4f..b595ad34 100644 --- a/README.md +++ b/README.md @@ -19,21 +19,8 @@ yarn add eth-hooks [@austinGriffith](https://github.com/austintgriffith) [@shravansunder](https://github.com/ShravanSunder) -## Dependencies - -- peer dependencies - - react/react-dom - - web3 - - @uniswap/sdk -- dependencies - - ethers - - web3-react - - web3modal -- test utilities dependencies: `/helpers/test-utils` - - hardhat/hardhat-waffle/hardhat-ethers - - waffle - # API Docs -- [Docs @gitbook](https://docs.scaffoldeth.io/scaffold-eth-libraries/v/eth-hooks-v3/) -- [Docs @github.io](https://scaffold-eth.github.io/eth-hooks/) +[Check out the documentation!](https://scaffold-eth.github.io/eth-hooks/) + +The docs are also available on gitbook: [Documentation@gitbook](https://docs.scaffoldeth.io/scaffold-eth-libraries/v/eth-hooks-v3/) diff --git a/docs/README.md b/docs/README.md index cb35b617..140d77f2 100644 --- a/docs/README.md +++ b/docs/README.md @@ -4,32 +4,8 @@ Commonly used Ethereum hooks. Used by 🏗 [scaffold-eth](https://github.com/scaffold-eth/scaffold-eth) Used by ⚙ [eth-components](https://github.com/scaffold-eth/eth-components) - Created by 🏰 [BuidlGuidl.eth](https://BuidlGuidl.com) -## Install - -```sh -yarn add eth-hooks -``` - -## Authors - -[@austinGriffith](https://github.com/austintgriffith) -[@shravansunder](https://github.com/ShravanSunder) - -## Peer Dependencies - -- react -- web3 - - @uniswap/sdk - -## Dependencies - -- ethers -- web3-react -- web3modal - # API Docs [Eth-Hooks API Overview](./api-typedocs/api-overview.md) diff --git a/docs/api-typedocs/classes/EthersContext.CouldNotActivateError.md b/docs/api-typedocs/classes/EthersContext.CouldNotActivateError.md index e056bc47..d8ca6529 100644 --- a/docs/api-typedocs/classes/EthersContext.CouldNotActivateError.md +++ b/docs/api-typedocs/classes/EthersContext.CouldNotActivateError.md @@ -162,4 +162,4 @@ Error.constructor #### Defined in -[src/context/ethers/connectors/connectorErrors.ts:16](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/context/ethers/connectors/connectorErrors.ts#L16) +[src/context/ethers/connectors/connectorErrors.ts:16](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/context/ethers/connectors/connectorErrors.ts#L16) diff --git a/docs/api-typedocs/classes/EthersContext.EthersModalConnector.md b/docs/api-typedocs/classes/EthersContext.EthersModalConnector.md index aa51087f..f51fe359 100644 --- a/docs/api-typedocs/classes/EthersContext.EthersModalConnector.md +++ b/docs/api-typedocs/classes/EthersContext.EthersModalConnector.md @@ -1131,7 +1131,7 @@ ___ #### Defined in -[src/context/ethers/connectors/EthersModalConnector.ts:76](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/context/ethers/connectors/EthersModalConnector.ts#L76) +[src/context/ethers/connectors/EthersModalConnector.ts:76](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/context/ethers/connectors/EthersModalConnector.ts#L76) ___ @@ -1151,7 +1151,7 @@ ___ #### Defined in -[src/context/ethers/connectors/EthersModalConnector.ts:106](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/context/ethers/connectors/EthersModalConnector.ts#L106) +[src/context/ethers/connectors/EthersModalConnector.ts:106](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/context/ethers/connectors/EthersModalConnector.ts#L106) ___ @@ -1165,7 +1165,7 @@ ___ #### Defined in -[src/context/ethers/connectors/EthersModalConnector.ts:154](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/context/ethers/connectors/EthersModalConnector.ts#L154) +[src/context/ethers/connectors/EthersModalConnector.ts:154](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/context/ethers/connectors/EthersModalConnector.ts#L154) ___ @@ -1196,7 +1196,7 @@ AbstractConnector.activate #### Defined in -[src/context/ethers/connectors/EthersModalConnector.ts:175](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/context/ethers/connectors/EthersModalConnector.ts#L175) +[src/context/ethers/connectors/EthersModalConnector.ts:175](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/context/ethers/connectors/EthersModalConnector.ts#L175) ___ @@ -1217,7 +1217,7 @@ AbstractConnector.deactivate #### Defined in -[src/context/ethers/connectors/EthersModalConnector.ts:233](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/context/ethers/connectors/EthersModalConnector.ts#L233) +[src/context/ethers/connectors/EthersModalConnector.ts:233](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/context/ethers/connectors/EthersModalConnector.ts#L233) ___ @@ -1235,7 +1235,7 @@ AbstractConnector.getProvider #### Defined in -[src/context/ethers/connectors/EthersModalConnector.ts:253](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/context/ethers/connectors/EthersModalConnector.ts#L253) +[src/context/ethers/connectors/EthersModalConnector.ts:253](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/context/ethers/connectors/EthersModalConnector.ts#L253) ___ @@ -1253,7 +1253,7 @@ AbstractConnector.getChainId #### Defined in -[src/context/ethers/connectors/EthersModalConnector.ts:257](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/context/ethers/connectors/EthersModalConnector.ts#L257) +[src/context/ethers/connectors/EthersModalConnector.ts:257](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/context/ethers/connectors/EthersModalConnector.ts#L257) ___ @@ -1271,7 +1271,7 @@ AbstractConnector.getAccount #### Defined in -[src/context/ethers/connectors/EthersModalConnector.ts:267](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/context/ethers/connectors/EthersModalConnector.ts#L267) +[src/context/ethers/connectors/EthersModalConnector.ts:267](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/context/ethers/connectors/EthersModalConnector.ts#L267) ___ @@ -1289,7 +1289,7 @@ ___ #### Defined in -[src/context/ethers/connectors/EthersModalConnector.ts:279](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/context/ethers/connectors/EthersModalConnector.ts#L279) +[src/context/ethers/connectors/EthersModalConnector.ts:279](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/context/ethers/connectors/EthersModalConnector.ts#L279) ___ @@ -1303,7 +1303,7 @@ ___ #### Defined in -[src/context/ethers/connectors/EthersModalConnector.ts:283](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/context/ethers/connectors/EthersModalConnector.ts#L283) +[src/context/ethers/connectors/EthersModalConnector.ts:283](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/context/ethers/connectors/EthersModalConnector.ts#L283) ___ @@ -1330,7 +1330,7 @@ Change the current signer and account used by the connector #### Defined in -[src/context/ethers/connectors/EthersModalConnector.ts:294](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/context/ethers/connectors/EthersModalConnector.ts#L294) +[src/context/ethers/connectors/EthersModalConnector.ts:294](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/context/ethers/connectors/EthersModalConnector.ts#L294) ___ @@ -1344,7 +1344,7 @@ ___ #### Defined in -[src/context/ethers/connectors/EthersModalConnector.ts:305](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/context/ethers/connectors/EthersModalConnector.ts#L305) +[src/context/ethers/connectors/EthersModalConnector.ts:305](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/context/ethers/connectors/EthersModalConnector.ts#L305) ___ @@ -1365,7 +1365,7 @@ Resets the web3Modal and clears the cache #### Defined in -[src/context/ethers/connectors/EthersModalConnector.ts:313](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/context/ethers/connectors/EthersModalConnector.ts#L313) +[src/context/ethers/connectors/EthersModalConnector.ts:313](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/context/ethers/connectors/EthersModalConnector.ts#L313) ___ @@ -1392,7 +1392,7 @@ Sets the web3modal theme: light | dark | ThemeColors #### Defined in -[src/context/ethers/connectors/EthersModalConnector.ts:328](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/context/ethers/connectors/EthersModalConnector.ts#L328) +[src/context/ethers/connectors/EthersModalConnector.ts:328](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/context/ethers/connectors/EthersModalConnector.ts#L328) ## Properties @@ -1482,7 +1482,7 @@ ___ #### Defined in -[src/context/ethers/connectors/EthersModalConnector.ts:62](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/context/ethers/connectors/EthersModalConnector.ts#L62) +[src/context/ethers/connectors/EthersModalConnector.ts:62](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/context/ethers/connectors/EthersModalConnector.ts#L62) ___ @@ -1492,7 +1492,7 @@ ___ #### Defined in -[src/context/ethers/connectors/EthersModalConnector.ts:63](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/context/ethers/connectors/EthersModalConnector.ts#L63) +[src/context/ethers/connectors/EthersModalConnector.ts:63](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/context/ethers/connectors/EthersModalConnector.ts#L63) ___ @@ -1502,7 +1502,7 @@ ___ #### Defined in -[src/context/ethers/connectors/EthersModalConnector.ts:64](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/context/ethers/connectors/EthersModalConnector.ts#L64) +[src/context/ethers/connectors/EthersModalConnector.ts:64](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/context/ethers/connectors/EthersModalConnector.ts#L64) ___ @@ -1512,7 +1512,7 @@ ___ #### Defined in -[src/context/ethers/connectors/EthersModalConnector.ts:65](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/context/ethers/connectors/EthersModalConnector.ts#L65) +[src/context/ethers/connectors/EthersModalConnector.ts:65](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/context/ethers/connectors/EthersModalConnector.ts#L65) ___ @@ -1522,7 +1522,7 @@ ___ #### Defined in -[src/context/ethers/connectors/EthersModalConnector.ts:66](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/context/ethers/connectors/EthersModalConnector.ts#L66) +[src/context/ethers/connectors/EthersModalConnector.ts:66](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/context/ethers/connectors/EthersModalConnector.ts#L66) ___ @@ -1532,7 +1532,7 @@ ___ #### Defined in -[src/context/ethers/connectors/EthersModalConnector.ts:67](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/context/ethers/connectors/EthersModalConnector.ts#L67) +[src/context/ethers/connectors/EthersModalConnector.ts:67](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/context/ethers/connectors/EthersModalConnector.ts#L67) ___ @@ -1542,7 +1542,7 @@ ___ #### Defined in -[src/context/ethers/connectors/EthersModalConnector.ts:68](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/context/ethers/connectors/EthersModalConnector.ts#L68) +[src/context/ethers/connectors/EthersModalConnector.ts:68](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/context/ethers/connectors/EthersModalConnector.ts#L68) ___ @@ -1552,7 +1552,7 @@ ___ #### Defined in -[src/context/ethers/connectors/EthersModalConnector.ts:69](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/context/ethers/connectors/EthersModalConnector.ts#L69) +[src/context/ethers/connectors/EthersModalConnector.ts:69](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/context/ethers/connectors/EthersModalConnector.ts#L69) ___ @@ -1562,7 +1562,7 @@ ___ #### Defined in -[src/context/ethers/connectors/EthersModalConnector.ts:70](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/context/ethers/connectors/EthersModalConnector.ts#L70) +[src/context/ethers/connectors/EthersModalConnector.ts:70](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/context/ethers/connectors/EthersModalConnector.ts#L70) ## Constructors @@ -1585,7 +1585,7 @@ AbstractConnector.constructor #### Defined in -[src/context/ethers/connectors/EthersModalConnector.ts:86](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/context/ethers/connectors/EthersModalConnector.ts#L86) +[src/context/ethers/connectors/EthersModalConnector.ts:86](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/context/ethers/connectors/EthersModalConnector.ts#L86) ## Accessors @@ -1599,4 +1599,4 @@ AbstractConnector.constructor #### Defined in -[src/context/ethers/connectors/EthersModalConnector.ts:72](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/context/ethers/connectors/EthersModalConnector.ts#L72) +[src/context/ethers/connectors/EthersModalConnector.ts:72](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/context/ethers/connectors/EthersModalConnector.ts#L72) diff --git a/docs/api-typedocs/classes/EthersContext.NoEthereumProviderFoundError.md b/docs/api-typedocs/classes/EthersContext.NoEthereumProviderFoundError.md index 318c12d1..e6c9f259 100644 --- a/docs/api-typedocs/classes/EthersContext.NoEthereumProviderFoundError.md +++ b/docs/api-typedocs/classes/EthersContext.NoEthereumProviderFoundError.md @@ -156,4 +156,4 @@ Error.constructor #### Defined in -[src/context/ethers/connectors/connectorErrors.ts:27](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/context/ethers/connectors/connectorErrors.ts#L27) +[src/context/ethers/connectors/connectorErrors.ts:27](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/context/ethers/connectors/connectorErrors.ts#L27) diff --git a/docs/api-typedocs/classes/EthersContext.UserClosedModalError.md b/docs/api-typedocs/classes/EthersContext.UserClosedModalError.md index b538ea1f..bc1488ce 100644 --- a/docs/api-typedocs/classes/EthersContext.UserClosedModalError.md +++ b/docs/api-typedocs/classes/EthersContext.UserClosedModalError.md @@ -156,4 +156,4 @@ Error.constructor #### Defined in -[src/context/ethers/connectors/connectorErrors.ts:5](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/context/ethers/connectors/connectorErrors.ts#L5) +[src/context/ethers/connectors/connectorErrors.ts:5](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/context/ethers/connectors/connectorErrors.ts#L5) diff --git a/docs/api-typedocs/classes/TestUtils.MockConnector.md b/docs/api-typedocs/classes/TestUtils.MockConnector.md index 1e86fb29..1595251f 100644 --- a/docs/api-typedocs/classes/TestUtils.MockConnector.md +++ b/docs/api-typedocs/classes/TestUtils.MockConnector.md @@ -1110,7 +1110,7 @@ ___ #### Defined in -[src/helpers/test-utils/wrapper/MockConnector.ts:33](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/helpers/test-utils/wrapper/MockConnector.ts#L33) +[src/helpers/test-utils/wrapper/MockConnector.ts:33](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/helpers/test-utils/wrapper/MockConnector.ts#L33) ___ @@ -1128,7 +1128,7 @@ ___ #### Defined in -[src/helpers/test-utils/wrapper/MockConnector.ts:39](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/helpers/test-utils/wrapper/MockConnector.ts#L39) +[src/helpers/test-utils/wrapper/MockConnector.ts:39](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/helpers/test-utils/wrapper/MockConnector.ts#L39) ___ @@ -1146,7 +1146,7 @@ ___ #### Defined in -[src/helpers/test-utils/wrapper/MockConnector.ts:43](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/helpers/test-utils/wrapper/MockConnector.ts#L43) +[src/helpers/test-utils/wrapper/MockConnector.ts:43](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/helpers/test-utils/wrapper/MockConnector.ts#L43) ___ @@ -1170,7 +1170,7 @@ ___ #### Defined in -[src/helpers/test-utils/wrapper/MockConnector.ts:46](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/helpers/test-utils/wrapper/MockConnector.ts#L46) +[src/helpers/test-utils/wrapper/MockConnector.ts:46](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/helpers/test-utils/wrapper/MockConnector.ts#L46) ___ @@ -1188,7 +1188,7 @@ ___ #### Defined in -[src/helpers/test-utils/wrapper/MockConnector.ts:49](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/helpers/test-utils/wrapper/MockConnector.ts#L49) +[src/helpers/test-utils/wrapper/MockConnector.ts:49](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/helpers/test-utils/wrapper/MockConnector.ts#L49) ___ @@ -1212,7 +1212,7 @@ ___ #### Defined in -[src/helpers/test-utils/wrapper/MockConnector.ts:53](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/helpers/test-utils/wrapper/MockConnector.ts#L53) +[src/helpers/test-utils/wrapper/MockConnector.ts:53](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/helpers/test-utils/wrapper/MockConnector.ts#L53) ___ @@ -1230,7 +1230,7 @@ AbstractConnector.activate #### Defined in -[src/helpers/test-utils/wrapper/MockConnector.ts:61](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/helpers/test-utils/wrapper/MockConnector.ts#L61) +[src/helpers/test-utils/wrapper/MockConnector.ts:61](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/helpers/test-utils/wrapper/MockConnector.ts#L61) ___ @@ -1248,7 +1248,7 @@ AbstractConnector.getProvider #### Defined in -[src/helpers/test-utils/wrapper/MockConnector.ts:69](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/helpers/test-utils/wrapper/MockConnector.ts#L69) +[src/helpers/test-utils/wrapper/MockConnector.ts:69](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/helpers/test-utils/wrapper/MockConnector.ts#L69) ___ @@ -1266,7 +1266,7 @@ AbstractConnector.getChainId #### Defined in -[src/helpers/test-utils/wrapper/MockConnector.ts:73](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/helpers/test-utils/wrapper/MockConnector.ts#L73) +[src/helpers/test-utils/wrapper/MockConnector.ts:73](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/helpers/test-utils/wrapper/MockConnector.ts#L73) ___ @@ -1284,7 +1284,7 @@ AbstractConnector.getAccount #### Defined in -[src/helpers/test-utils/wrapper/MockConnector.ts:77](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/helpers/test-utils/wrapper/MockConnector.ts#L77) +[src/helpers/test-utils/wrapper/MockConnector.ts:77](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/helpers/test-utils/wrapper/MockConnector.ts#L77) ___ @@ -1304,7 +1304,7 @@ ___ #### Defined in -[src/helpers/test-utils/wrapper/MockConnector.ts:82](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/helpers/test-utils/wrapper/MockConnector.ts#L82) +[src/helpers/test-utils/wrapper/MockConnector.ts:82](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/helpers/test-utils/wrapper/MockConnector.ts#L82) ___ @@ -1322,7 +1322,7 @@ AbstractConnector.deactivate #### Defined in -[src/helpers/test-utils/wrapper/MockConnector.ts:87](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/helpers/test-utils/wrapper/MockConnector.ts#L87) +[src/helpers/test-utils/wrapper/MockConnector.ts:87](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/helpers/test-utils/wrapper/MockConnector.ts#L87) ## Properties @@ -1412,7 +1412,7 @@ ___ #### Defined in -[src/helpers/test-utils/wrapper/MockConnector.ts:14](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/helpers/test-utils/wrapper/MockConnector.ts#L14) +[src/helpers/test-utils/wrapper/MockConnector.ts:14](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/helpers/test-utils/wrapper/MockConnector.ts#L14) ___ @@ -1422,7 +1422,7 @@ ___ #### Defined in -[src/helpers/test-utils/wrapper/MockConnector.ts:15](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/helpers/test-utils/wrapper/MockConnector.ts#L15) +[src/helpers/test-utils/wrapper/MockConnector.ts:15](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/helpers/test-utils/wrapper/MockConnector.ts#L15) ___ @@ -1432,7 +1432,7 @@ ___ #### Defined in -[src/helpers/test-utils/wrapper/MockConnector.ts:17](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/helpers/test-utils/wrapper/MockConnector.ts#L17) +[src/helpers/test-utils/wrapper/MockConnector.ts:17](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/helpers/test-utils/wrapper/MockConnector.ts#L17) ___ @@ -1442,7 +1442,7 @@ ___ #### Defined in -[src/helpers/test-utils/wrapper/MockConnector.ts:18](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/helpers/test-utils/wrapper/MockConnector.ts#L18) +[src/helpers/test-utils/wrapper/MockConnector.ts:18](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/helpers/test-utils/wrapper/MockConnector.ts#L18) ___ @@ -1452,7 +1452,7 @@ ___ #### Defined in -[src/helpers/test-utils/wrapper/MockConnector.ts:20](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/helpers/test-utils/wrapper/MockConnector.ts#L20) +[src/helpers/test-utils/wrapper/MockConnector.ts:20](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/helpers/test-utils/wrapper/MockConnector.ts#L20) ___ @@ -1462,7 +1462,7 @@ ___ #### Defined in -[src/helpers/test-utils/wrapper/MockConnector.ts:21](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/helpers/test-utils/wrapper/MockConnector.ts#L21) +[src/helpers/test-utils/wrapper/MockConnector.ts:21](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/helpers/test-utils/wrapper/MockConnector.ts#L21) ___ @@ -1472,7 +1472,7 @@ ___ #### Defined in -[src/helpers/test-utils/wrapper/MockConnector.ts:22](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/helpers/test-utils/wrapper/MockConnector.ts#L22) +[src/helpers/test-utils/wrapper/MockConnector.ts:22](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/helpers/test-utils/wrapper/MockConnector.ts#L22) ___ @@ -1482,7 +1482,7 @@ ___ #### Defined in -[src/helpers/test-utils/wrapper/MockConnector.ts:23](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/helpers/test-utils/wrapper/MockConnector.ts#L23) +[src/helpers/test-utils/wrapper/MockConnector.ts:23](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/helpers/test-utils/wrapper/MockConnector.ts#L23) ___ @@ -1492,7 +1492,7 @@ ___ #### Defined in -[src/helpers/test-utils/wrapper/MockConnector.ts:24](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/helpers/test-utils/wrapper/MockConnector.ts#L24) +[src/helpers/test-utils/wrapper/MockConnector.ts:24](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/helpers/test-utils/wrapper/MockConnector.ts#L24) ## Constructors @@ -1512,4 +1512,4 @@ AbstractConnector.constructor #### Defined in -[src/helpers/test-utils/wrapper/MockConnector.ts:26](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/helpers/test-utils/wrapper/MockConnector.ts#L26) +[src/helpers/test-utils/wrapper/MockConnector.ts:26](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/helpers/test-utils/wrapper/MockConnector.ts#L26) diff --git a/docs/api-typedocs/interfaces/EthersContext.ICommonModalConnector.md b/docs/api-typedocs/interfaces/EthersContext.ICommonModalConnector.md index 8fd62fba..f9618ceb 100644 --- a/docs/api-typedocs/interfaces/EthersContext.ICommonModalConnector.md +++ b/docs/api-typedocs/interfaces/EthersContext.ICommonModalConnector.md @@ -34,7 +34,7 @@ An interface implemented by [EthersModalConnector](../classes/EthersContext.Ethe #### Defined in -[src/context/ethers/connectors/EthersModalConnector.ts:38](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/context/ethers/connectors/EthersModalConnector.ts#L38) +[src/context/ethers/connectors/EthersModalConnector.ts:38](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/context/ethers/connectors/EthersModalConnector.ts#L38) ___ @@ -54,7 +54,7 @@ ___ #### Defined in -[src/context/ethers/connectors/EthersModalConnector.ts:39](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/context/ethers/connectors/EthersModalConnector.ts#L39) +[src/context/ethers/connectors/EthersModalConnector.ts:39](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/context/ethers/connectors/EthersModalConnector.ts#L39) ___ @@ -68,7 +68,7 @@ ___ #### Defined in -[src/context/ethers/connectors/EthersModalConnector.ts:40](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/context/ethers/connectors/EthersModalConnector.ts#L40) +[src/context/ethers/connectors/EthersModalConnector.ts:40](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/context/ethers/connectors/EthersModalConnector.ts#L40) ___ @@ -88,7 +88,7 @@ ___ #### Defined in -[src/context/ethers/connectors/EthersModalConnector.ts:41](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/context/ethers/connectors/EthersModalConnector.ts#L41) +[src/context/ethers/connectors/EthersModalConnector.ts:41](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/context/ethers/connectors/EthersModalConnector.ts#L41) ___ @@ -102,4 +102,4 @@ ___ #### Defined in -[src/context/ethers/connectors/EthersModalConnector.ts:42](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/context/ethers/connectors/EthersModalConnector.ts#L42) +[src/context/ethers/connectors/EthersModalConnector.ts:42](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/context/ethers/connectors/EthersModalConnector.ts#L42) diff --git a/docs/api-typedocs/interfaces/EthersContext.IStaticJsonRpcProviderConnectorOptions.md b/docs/api-typedocs/interfaces/EthersContext.IStaticJsonRpcProviderConnectorOptions.md index 68529ecd..84890f29 100644 --- a/docs/api-typedocs/interfaces/EthersContext.IStaticJsonRpcProviderConnectorOptions.md +++ b/docs/api-typedocs/interfaces/EthersContext.IStaticJsonRpcProviderConnectorOptions.md @@ -48,7 +48,7 @@ ___ #### Defined in -[src/context/ethers/connectors/StaticJsonRpcProviderConnector.ts:12](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/context/ethers/connectors/StaticJsonRpcProviderConnector.ts#L12) +[src/context/ethers/connectors/StaticJsonRpcProviderConnector.ts:12](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/context/ethers/connectors/StaticJsonRpcProviderConnector.ts#L12) ___ @@ -58,4 +58,4 @@ ___ #### Defined in -[src/context/ethers/connectors/StaticJsonRpcProviderConnector.ts:13](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/context/ethers/connectors/StaticJsonRpcProviderConnector.ts#L13) +[src/context/ethers/connectors/StaticJsonRpcProviderConnector.ts:13](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/context/ethers/connectors/StaticJsonRpcProviderConnector.ts#L13) diff --git a/docs/api-typedocs/interfaces/Models.IEthersContext.md b/docs/api-typedocs/interfaces/Models.IEthersContext.md index 2b55f8a9..93ee7c83 100644 --- a/docs/api-typedocs/interfaces/Models.IEthersContext.md +++ b/docs/api-typedocs/interfaces/Models.IEthersContext.md @@ -126,7 +126,7 @@ ___ #### Defined in -[src/models/ethersAppContextTypes.ts:37](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/models/ethersAppContextTypes.ts#L37) +[src/models/ethersAppContextTypes.ts:37](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/models/ethersAppContextTypes.ts#L37) ___ @@ -140,7 +140,7 @@ ___ #### Defined in -[src/models/ethersAppContextTypes.ts:38](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/models/ethersAppContextTypes.ts#L38) +[src/models/ethersAppContextTypes.ts:38](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/models/ethersAppContextTypes.ts#L38) ## Properties @@ -182,7 +182,7 @@ Web3ReactContextInterface.connector #### Defined in -[src/models/ethersAppContextTypes.ts:30](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/models/ethersAppContextTypes.ts#L30) +[src/models/ethersAppContextTypes.ts:30](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/models/ethersAppContextTypes.ts#L30) ___ @@ -192,7 +192,7 @@ ___ #### Defined in -[src/models/ethersAppContextTypes.ts:31](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/models/ethersAppContextTypes.ts#L31) +[src/models/ethersAppContextTypes.ts:31](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/models/ethersAppContextTypes.ts#L31) ___ @@ -206,7 +206,7 @@ Web3ReactContextInterface.active #### Defined in -[src/models/ethersAppContextTypes.ts:32](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/models/ethersAppContextTypes.ts#L32) +[src/models/ethersAppContextTypes.ts:32](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/models/ethersAppContextTypes.ts#L32) ___ @@ -216,7 +216,7 @@ ___ #### Defined in -[src/models/ethersAppContextTypes.ts:33](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/models/ethersAppContextTypes.ts#L33) +[src/models/ethersAppContextTypes.ts:33](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/models/ethersAppContextTypes.ts#L33) ___ @@ -230,7 +230,7 @@ Web3ReactContextInterface.account #### Defined in -[src/models/ethersAppContextTypes.ts:34](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/models/ethersAppContextTypes.ts#L34) +[src/models/ethersAppContextTypes.ts:34](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/models/ethersAppContextTypes.ts#L34) ___ @@ -244,7 +244,7 @@ Web3ReactContextInterface.chainId #### Defined in -[src/models/ethersAppContextTypes.ts:35](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/models/ethersAppContextTypes.ts#L35) +[src/models/ethersAppContextTypes.ts:35](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/models/ethersAppContextTypes.ts#L35) ___ @@ -254,7 +254,7 @@ ___ #### Defined in -[src/models/ethersAppContextTypes.ts:36](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/models/ethersAppContextTypes.ts#L36) +[src/models/ethersAppContextTypes.ts:36](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/models/ethersAppContextTypes.ts#L36) ___ @@ -264,4 +264,4 @@ ___ #### Defined in -[src/models/ethersAppContextTypes.ts:39](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/models/ethersAppContextTypes.ts#L39) +[src/models/ethersAppContextTypes.ts:39](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/models/ethersAppContextTypes.ts#L39) diff --git a/docs/api-typedocs/modules/EthersContext.md b/docs/api-typedocs/modules/EthersContext.md index 9564eb2e..bdfda6b9 100644 --- a/docs/api-typedocs/modules/EthersContext.md +++ b/docs/api-typedocs/modules/EthersContext.md @@ -77,7 +77,7 @@ current block number #### Defined in -[src/context/ethers/BlockNumberContext.tsx:64](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/context/ethers/BlockNumberContext.tsx#L64) +[src/context/ethers/BlockNumberContext.tsx:64](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/context/ethers/BlockNumberContext.tsx#L64) ___ @@ -111,7 +111,7 @@ Gives you access to consistent interface to get the current provider information #### Defined in -[src/context/ethers/EthersAppContext.tsx:37](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/context/ethers/EthersAppContext.tsx#L37) +[src/context/ethers/EthersAppContext.tsx:37](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/context/ethers/EthersAppContext.tsx#L37) ___ @@ -140,7 +140,7 @@ See scaffold-eth-typescript for an example that uses it to connect to a localhos #### Defined in -[src/context/ethers/connectors/StaticJsonRpcProviderConnector.ts:31](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/context/ethers/connectors/StaticJsonRpcProviderConnector.ts#L31) +[src/context/ethers/connectors/StaticJsonRpcProviderConnector.ts:31](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/context/ethers/connectors/StaticJsonRpcProviderConnector.ts#L31) ___ @@ -172,7 +172,7 @@ ___ #### Defined in -[src/context/app-contracts/contractConnectors.ts:44](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/context/app-contracts/contractConnectors.ts#L44) +[src/context/app-contracts/contractConnectors.ts:44](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/context/app-contracts/contractConnectors.ts#L44) ___ @@ -202,7 +202,7 @@ ___ #### Defined in -[src/context/app-contracts/contractConnectors.ts:74](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/context/app-contracts/contractConnectors.ts#L74) +[src/context/app-contracts/contractConnectors.ts:74](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/context/app-contracts/contractConnectors.ts#L74) ___ @@ -230,7 +230,7 @@ ___ #### Defined in -[src/context/app-contracts/contractConnectors.ts:104](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/context/app-contracts/contractConnectors.ts#L104) +[src/context/app-contracts/contractConnectors.ts:104](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/context/app-contracts/contractConnectors.ts#L104) ___ @@ -259,7 +259,7 @@ ___ #### Defined in -[src/context/app-contracts/contractConnectors.ts:120](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/context/app-contracts/contractConnectors.ts#L120) +[src/context/app-contracts/contractConnectors.ts:120](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/context/app-contracts/contractConnectors.ts#L120) ___ @@ -295,7 +295,7 @@ ___ #### Defined in -[src/context/app-contracts/contractsContextFactory.tsx:79](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/context/app-contracts/contractsContextFactory.tsx#L79) +[src/context/app-contracts/contractsContextFactory.tsx:79](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/context/app-contracts/contractsContextFactory.tsx#L79) ## Type aliases @@ -311,7 +311,7 @@ ___ #### Defined in -[src/context/app-contracts/contractsContextFactory.tsx:22](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/context/app-contracts/contractsContextFactory.tsx#L22) +[src/context/app-contracts/contractsContextFactory.tsx:22](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/context/app-contracts/contractsContextFactory.tsx#L22) ___ @@ -338,7 +338,7 @@ ___ #### Defined in -[src/context/app-contracts/contractsContextFactory.tsx:60](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/context/app-contracts/contractsContextFactory.tsx#L60) +[src/context/app-contracts/contractsContextFactory.tsx:60](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/context/app-contracts/contractsContextFactory.tsx#L60) ___ @@ -360,7 +360,7 @@ Props for context that allow you specify alternate web3ReactRoot [See docs](http #### Defined in -[src/context/ethers/EthersAppContext.tsx:97](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/context/ethers/EthersAppContext.tsx#L97) +[src/context/ethers/EthersAppContext.tsx:97](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/context/ethers/EthersAppContext.tsx#L97) ___ @@ -370,7 +370,7 @@ ___ #### Defined in -[src/context/ethers/connectors/EthersModalConnector.ts:45](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/context/ethers/connectors/EthersModalConnector.ts#L45) +[src/context/ethers/connectors/EthersModalConnector.ts:45](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/context/ethers/connectors/EthersModalConnector.ts#L45) ## EthersContext Variables @@ -387,7 +387,7 @@ A context that works with [useBlockNumberContext](EthersContext.md#useblocknumbe #### Defined in -[src/context/ethers/BlockNumberContext.tsx:86](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/context/ethers/BlockNumberContext.tsx#L86) +[src/context/ethers/BlockNumberContext.tsx:86](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/context/ethers/BlockNumberContext.tsx#L86) ___ @@ -405,7 +405,7 @@ This is a wrapper around Web3ReactProvider that provides additional functionalit #### Defined in -[src/context/ethers/EthersAppContext.tsx:144](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/context/ethers/EthersAppContext.tsx#L144) +[src/context/ethers/EthersAppContext.tsx:144](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/context/ethers/EthersAppContext.tsx#L144) ___ @@ -417,4 +417,4 @@ ___ #### Defined in -[src/context/ethers/queryClient.ts:3](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/context/ethers/queryClient.ts#L3) +[src/context/ethers/queryClient.ts:3](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/context/ethers/queryClient.ts#L3) diff --git a/docs/api-typedocs/modules/Helpers.md b/docs/api-typedocs/modules/Helpers.md index fb065fb5..9f79d79b 100644 --- a/docs/api-typedocs/modules/Helpers.md +++ b/docs/api-typedocs/modules/Helpers.md @@ -43,4 +43,4 @@ const ExampleUI = lazier(() => import('./exampleui/ExampleUI'), 'ExampleUI'); #### Defined in -[src/helpers/lazier.ts:18](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/helpers/lazier.ts#L18) +[src/helpers/lazier.ts:18](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/helpers/lazier.ts#L18) diff --git a/docs/api-typedocs/modules/Hooks.md b/docs/api-typedocs/modules/Hooks.md index f14aaaf2..cae37efd 100644 --- a/docs/api-typedocs/modules/Hooks.md +++ b/docs/api-typedocs/modules/Hooks.md @@ -70,7 +70,7 @@ price in USD #### Defined in -[src/hooks/dapps/useDexEthPrice.ts:27](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/hooks/dapps/useDexEthPrice.ts#L27) +[src/hooks/dapps/useDexEthPrice.ts:27](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/hooks/dapps/useDexEthPrice.ts#L27) ___ @@ -100,7 +100,7 @@ Gets a tokenlist from uniswap ipfs tokenlist #### Defined in -[src/hooks/dapps/useDexTokenList.ts:27](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/hooks/dapps/useDexTokenList.ts#L27) +[src/hooks/dapps/useDexTokenList.ts:27](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/hooks/dapps/useDexTokenList.ts#L27) ___ @@ -124,7 +124,7 @@ Gets the address from an ENS name #### Defined in -[src/hooks/dapps/useResolveEnsAddress.ts:19](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/hooks/dapps/useResolveEnsAddress.ts#L19) +[src/hooks/dapps/useResolveEnsAddress.ts:19](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/hooks/dapps/useResolveEnsAddress.ts#L19) ___ @@ -148,7 +148,7 @@ Gets ENS name for given address #### Defined in -[src/hooks/dapps/useResolveEnsName.ts:45](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/hooks/dapps/useResolveEnsName.ts#L45) +[src/hooks/dapps/useResolveEnsName.ts:45](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/hooks/dapps/useResolveEnsName.ts#L45) ___ @@ -183,7 +183,7 @@ Get the balance of an ERC20 token in an address #### Defined in -[src/hooks/erc/useTokenBalance.ts:33](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/hooks/erc/useTokenBalance.ts#L33) +[src/hooks/erc/useTokenBalance.ts:33](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/hooks/erc/useTokenBalance.ts#L33) ___ @@ -207,7 +207,7 @@ Are the signers equal and valid #### Defined in -[src/hooks/useAreSignerEqual.ts:17](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/hooks/useAreSignerEqual.ts#L17) +[src/hooks/useAreSignerEqual.ts:17](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/hooks/useAreSignerEqual.ts#L17) ___ @@ -245,7 +245,7 @@ current balance #### Defined in -[src/hooks/useBalance.ts:34](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/hooks/useBalance.ts#L34) +[src/hooks/useBalance.ts:34](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/hooks/useBalance.ts#L34) ___ @@ -275,7 +275,7 @@ block number #### Defined in -[src/hooks/useBlockNumber.ts:19](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/hooks/useBlockNumber.ts#L19) +[src/hooks/useBlockNumber.ts:19](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/hooks/useBlockNumber.ts#L19) ___ @@ -301,7 +301,7 @@ IBurnerSigner #### Defined in -[src/hooks/useBurnerSigner.ts:87](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/hooks/useBurnerSigner.ts#L87) +[src/hooks/useBurnerSigner.ts:87](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/hooks/useBurnerSigner.ts#L87) ___ @@ -329,7 +329,7 @@ Checks whether a contract exists on the blockchain #### Defined in -[src/hooks/useContractExistsAtAddress.ts:25](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/hooks/useContractExistsAtAddress.ts#L25) +[src/hooks/useContractExistsAtAddress.ts:25](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/hooks/useContractExistsAtAddress.ts#L25) ___ @@ -367,7 +367,7 @@ Record of contractName:Contracts #### Defined in -[src/hooks/useContractLoader.ts:105](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/hooks/useContractLoader.ts#L105) +[src/hooks/useContractLoader.ts:105](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/hooks/useContractLoader.ts#L105) ___ @@ -406,7 +406,7 @@ Enables you to call a contract function with arguments and receive the output. #### Defined in -[src/hooks/useContractReader.ts:109](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/hooks/useContractReader.ts#L109) +[src/hooks/useContractReader.ts:109](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/hooks/useContractReader.ts#L109) ___ @@ -430,7 +430,7 @@ Gets the user {@link TEthersUser} for a signer or wallet #### Defined in -[src/hooks/useEthersAdaptorFromProviderOrSigners.ts:30](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/hooks/useEthersAdaptorFromProviderOrSigners.ts#L30) +[src/hooks/useEthersAdaptorFromProviderOrSigners.ts:30](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/hooks/useEthersAdaptorFromProviderOrSigners.ts#L30) ___ @@ -467,7 +467,7 @@ Tracks the events of associated with a contract #### Defined in -[src/hooks/useEventListener.ts:26](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/hooks/useEventListener.ts#L26) +[src/hooks/useEventListener.ts:26](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/hooks/useEventListener.ts#L26) ___ @@ -504,7 +504,7 @@ gas as gwei #### Defined in -[src/hooks/useGasPrice.ts:48](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/hooks/useGasPrice.ts#L48) +[src/hooks/useGasPrice.ts:48](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/hooks/useGasPrice.ts#L48) ___ @@ -533,7 +533,7 @@ Get the current nonce for the address provided #### Defined in -[src/hooks/useNonce.ts:33](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/hooks/useNonce.ts#L33) +[src/hooks/useNonce.ts:33](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/hooks/useNonce.ts#L33) ___ @@ -556,7 +556,7 @@ Get the address from the signer #### Defined in -[src/hooks/useSignerAddress.ts:19](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/hooks/useSignerAddress.ts#L19) +[src/hooks/useSignerAddress.ts:19](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/hooks/useSignerAddress.ts#L19) ___ @@ -580,7 +580,7 @@ Get the address from the signer #### Defined in -[src/hooks/useSignerChainId.ts:20](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/hooks/useSignerChainId.ts#L20) +[src/hooks/useSignerChainId.ts:20](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/hooks/useSignerChainId.ts#L20) ___ @@ -608,7 +608,7 @@ Get the current timestamp from the latest block #### Defined in -[src/hooks/useTimestamp.ts:30](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/hooks/useTimestamp.ts#L30) +[src/hooks/useTimestamp.ts:30](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/hooks/useTimestamp.ts#L30) ___ @@ -631,7 +631,7 @@ ___ #### Defined in -[src/hooks/useContractLoader.ts:59](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/hooks/useContractLoader.ts#L59) +[src/hooks/useContractLoader.ts:59](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/hooks/useContractLoader.ts#L59) ___ @@ -669,7 +669,7 @@ Enables you to call a contract function with arguments and receive the output. #### Defined in -[src/hooks/useContractReader.ts:27](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/hooks/useContractReader.ts#L27) +[src/hooks/useContractReader.ts:27](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/hooks/useContractReader.ts#L27) ## Hooks Type aliases @@ -698,7 +698,7 @@ Return type of useBurnerSigner: #### Defined in -[src/hooks/useBurnerSigner.ts:56](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/hooks/useBurnerSigner.ts#L56) +[src/hooks/useBurnerSigner.ts:56](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/hooks/useBurnerSigner.ts#L56) ___ @@ -714,7 +714,7 @@ Preset speeds for Eth Gas Station API #### Defined in -[src/hooks/useGasPrice.ts:28](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/hooks/useGasPrice.ts#L28) +[src/hooks/useGasPrice.ts:28](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/hooks/useGasPrice.ts#L28) ___ @@ -738,4 +738,4 @@ Configuration for useContractLoader #### Defined in -[src/hooks/useContractLoader.ts:39](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/hooks/useContractLoader.ts#L39) +[src/hooks/useContractLoader.ts:39](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/hooks/useContractLoader.ts#L39) diff --git a/docs/api-typedocs/modules/Models.md b/docs/api-typedocs/modules/Models.md index a86f2579..2d1fbc0b 100644 --- a/docs/api-typedocs/modules/Models.md +++ b/docs/api-typedocs/modules/Models.md @@ -67,7 +67,7 @@ Types and constants to make it easier to interact with ethers. #### Defined in -[src/models/constants/common.ts:1](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/models/constants/common.ts#L1) +[src/models/constants/common.ts:1](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/models/constants/common.ts#L1) ___ @@ -86,7 +86,7 @@ ___ #### Defined in -[src/models/constants/keyNamespace.ts:1](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/models/constants/keyNamespace.ts#L1) +[src/models/constants/keyNamespace.ts:1](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/models/constants/keyNamespace.ts#L1) ___ @@ -99,7 +99,7 @@ An constant for block number interval of 10 blocks #### Defined in -[src/models/hookOptions.ts:9](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/models/hookOptions.ts#L9) +[src/models/hookOptions.ts:9](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/models/hookOptions.ts#L9) ___ @@ -112,7 +112,7 @@ An constant for block number interval of 50 blocks #### Defined in -[src/models/hookOptions.ts:15](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/models/hookOptions.ts#L15) +[src/models/hookOptions.ts:15](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/models/hookOptions.ts#L15) ___ @@ -125,7 +125,7 @@ An constant for block number interval of 250 blocks #### Defined in -[src/models/hookOptions.ts:21](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/models/hookOptions.ts#L21) +[src/models/hookOptions.ts:21](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/models/hookOptions.ts#L21) ## EthersContext Type aliases @@ -156,7 +156,7 @@ A callback type that returns a EthersModalConnector #### Defined in -[src/models/ethersAppContextTypes.ts:17](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/models/ethersAppContextTypes.ts#L17) +[src/models/ethersAppContextTypes.ts:17](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/models/ethersAppContextTypes.ts#L17) ___ @@ -177,7 +177,7 @@ Describes the structure of hardhat_contracts.json #### Defined in -[src/models/contractTypes.ts:30](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/models/contractTypes.ts#L30) +[src/models/contractTypes.ts:30](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/models/contractTypes.ts#L30) ___ @@ -197,7 +197,7 @@ A type for external contracts #### Defined in -[src/models/contractTypes.ts:54](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/models/contractTypes.ts#L54) +[src/models/contractTypes.ts:54](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/models/contractTypes.ts#L54) ___ @@ -221,7 +221,7 @@ Contract function information: #### Defined in -[src/models/contractTypes.ts:69](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/models/contractTypes.ts#L69) +[src/models/contractTypes.ts:69](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/models/contractTypes.ts#L69) ___ @@ -247,7 +247,7 @@ A type that describes the basics of a network for applications. e.g. mainnet, ro #### Defined in -[src/models/networkTypes.ts:7](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/models/networkTypes.ts#L7) +[src/models/networkTypes.ts:7](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/models/networkTypes.ts#L7) ___ @@ -263,7 +263,7 @@ Used by eth-hooks, eth-components and scaffold-eth-typescript #### Defined in -[src/models/providerTypes.ts:19](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/models/providerTypes.ts#L19) +[src/models/providerTypes.ts:19](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/models/providerTypes.ts#L19) ___ @@ -276,7 +276,7 @@ A union of various providers and signers in ethers to give maximum flexibility #### Defined in -[src/models/providerTypes.ts:27](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/models/providerTypes.ts#L27) +[src/models/providerTypes.ts:27](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/models/providerTypes.ts#L27) ___ @@ -289,7 +289,7 @@ A union of various providers in ethers to give maximum flexibility #### Defined in -[src/models/providerTypes.ts:42](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/models/providerTypes.ts#L42) +[src/models/providerTypes.ts:42](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/models/providerTypes.ts#L42) ___ @@ -302,7 +302,7 @@ A union of abstract, non initalizable providers, used by some functions #### Defined in -[src/models/providerTypes.ts:50](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/models/providerTypes.ts#L50) +[src/models/providerTypes.ts:50](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/models/providerTypes.ts#L50) ___ @@ -322,7 +322,7 @@ An generic extension of EventFilter that is used by TypedEvent. It allows for t #### Defined in -[src/models/providerTypes.ts:58](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/models/providerTypes.ts#L58) +[src/models/providerTypes.ts:58](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/models/providerTypes.ts#L58) ___ @@ -341,7 +341,7 @@ An generic extension of Event. It types the the arguments and return values of #### Defined in -[src/models/providerTypes.ts:69](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/models/providerTypes.ts#L69) +[src/models/providerTypes.ts:69](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/models/providerTypes.ts#L69) ___ @@ -360,7 +360,7 @@ Similar to [partial](https://www.typescriptlang.org/docs/handbook/utility-types. #### Defined in -[src/models/utilityTypes.ts:7](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/models/utilityTypes.ts#L7) +[src/models/utilityTypes.ts:7](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/models/utilityTypes.ts#L7) ___ @@ -387,7 +387,7 @@ ___ #### Defined in -[src/models/contractContextTypes.ts:4](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/models/contractContextTypes.ts#L4) +[src/models/contractContextTypes.ts:4](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/models/contractContextTypes.ts#L4) ___ @@ -405,7 +405,7 @@ ___ #### Defined in -[src/models/contractContextTypes.ts:13](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/models/contractContextTypes.ts#L13) +[src/models/contractContextTypes.ts:13](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/models/contractContextTypes.ts#L13) ___ @@ -421,7 +421,7 @@ ___ #### Defined in -[src/models/contractContextTypes.ts:24](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/models/contractContextTypes.ts#L24) +[src/models/contractContextTypes.ts:24](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/models/contractContextTypes.ts#L24) ___ @@ -438,7 +438,7 @@ ___ #### Defined in -[src/models/contractContextTypes.ts:28](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/models/contractContextTypes.ts#L28) +[src/models/contractContextTypes.ts:28](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/models/contractContextTypes.ts#L28) ___ @@ -454,7 +454,7 @@ ___ #### Defined in -[src/models/contractContextTypes.ts:37](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/models/contractContextTypes.ts#L37) +[src/models/contractContextTypes.ts:37](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/models/contractContextTypes.ts#L37) ___ @@ -470,7 +470,7 @@ ___ #### Defined in -[src/models/contractContextTypes.ts:42](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/models/contractContextTypes.ts#L42) +[src/models/contractContextTypes.ts:42](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/models/contractContextTypes.ts#L42) ___ @@ -494,7 +494,7 @@ ___ #### Defined in -[src/models/contractContextTypes.ts:50](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/models/contractContextTypes.ts#L50) +[src/models/contractContextTypes.ts:50](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/models/contractContextTypes.ts#L50) ___ @@ -514,7 +514,7 @@ Describes the sctructure of each contract in hardhat_contracts.json #### Defined in -[src/models/contractTypes.ts:5](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/models/contractTypes.ts#L5) +[src/models/contractTypes.ts:5](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/models/contractTypes.ts#L5) ___ @@ -533,7 +533,7 @@ Contracts by contract name #### Defined in -[src/models/contractTypes.ts:16](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/models/contractTypes.ts#L16) +[src/models/contractTypes.ts:16](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/models/contractTypes.ts#L16) ___ @@ -563,7 +563,7 @@ The following options are available: #### Defined in -[src/models/hookOptions.ts:33](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/models/hookOptions.ts#L33) +[src/models/hookOptions.ts:33](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/models/hookOptions.ts#L33) ___ @@ -594,7 +594,7 @@ Alternate Context Key #### Defined in -[src/models/hookOptions.ts:76](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/models/hookOptions.ts#L76) +[src/models/hookOptions.ts:76](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/models/hookOptions.ts#L76) ___ @@ -619,7 +619,7 @@ Essentially a object that allows interaction with the network: #### Defined in -[src/models/ethersAppContextTypes.ts:49](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/models/ethersAppContextTypes.ts#L49) +[src/models/ethersAppContextTypes.ts:49](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/models/ethersAppContextTypes.ts#L49) ## Functions @@ -635,7 +635,7 @@ An helper to create the default override settings for hooks #### Defined in -[src/models/hookOptions.ts:96](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/models/hookOptions.ts#L96) +[src/models/hookOptions.ts:96](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/models/hookOptions.ts#L96) ___ @@ -651,4 +651,4 @@ A helper to create default update options for hooks #### Defined in -[src/models/hookOptions.ts:108](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/models/hookOptions.ts#L108) +[src/models/hookOptions.ts:108](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/models/hookOptions.ts#L108) diff --git a/docs/api-typedocs/modules/TestUtils.md b/docs/api-typedocs/modules/TestUtils.md index ab5659c2..37ee494e 100644 --- a/docs/api-typedocs/modules/TestUtils.md +++ b/docs/api-typedocs/modules/TestUtils.md @@ -44,7 +44,7 @@ Utilities to write tests with ethers, waffle and react hooks #### Defined in -[src/helpers/test-utils/constants/testConstants.ts:3](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/helpers/test-utils/constants/testConstants.ts#L3) +[src/helpers/test-utils/constants/testConstants.ts:3](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/helpers/test-utils/constants/testConstants.ts#L3) ___ @@ -54,7 +54,7 @@ ___ #### Defined in -[src/helpers/test-utils/constants/testConstants.ts:5](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/helpers/test-utils/constants/testConstants.ts#L5) +[src/helpers/test-utils/constants/testConstants.ts:5](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/helpers/test-utils/constants/testConstants.ts#L5) ___ @@ -64,7 +64,7 @@ ___ #### Defined in -[src/helpers/test-utils/constants/testConstants.ts:7](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/helpers/test-utils/constants/testConstants.ts#L7) +[src/helpers/test-utils/constants/testConstants.ts:7](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/helpers/test-utils/constants/testConstants.ts#L7) ___ @@ -80,7 +80,7 @@ This is a wrapper for tests #### Defined in -[src/helpers/test-utils/wrapper/TestAppWrapper.tsx:37](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/helpers/test-utils/wrapper/TestAppWrapper.tsx#L37) +[src/helpers/test-utils/wrapper/TestAppWrapper.tsx:37](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/helpers/test-utils/wrapper/TestAppWrapper.tsx#L37) ## Functions @@ -100,7 +100,7 @@ This is a wrapper for tests #### Defined in -[src/helpers/test-utils/eth/hardhatActions.ts:3](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/helpers/test-utils/eth/hardhatActions.ts#L3) +[src/helpers/test-utils/eth/hardhatActions.ts:3](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/helpers/test-utils/eth/hardhatActions.ts#L3) ___ @@ -120,7 +120,7 @@ ___ #### Defined in -[src/helpers/test-utils/functions/conversions.ts:3](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/helpers/test-utils/functions/conversions.ts#L3) +[src/helpers/test-utils/functions/conversions.ts:3](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/helpers/test-utils/functions/conversions.ts#L3) ___ @@ -140,7 +140,7 @@ ___ #### Defined in -[src/helpers/test-utils/functions/conversions.ts:7](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/helpers/test-utils/functions/conversions.ts#L7) +[src/helpers/test-utils/functions/conversions.ts:7](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/helpers/test-utils/functions/conversions.ts#L7) ___ @@ -160,7 +160,7 @@ ___ #### Defined in -[src/helpers/test-utils/functions/expect.ts:4](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/helpers/test-utils/functions/expect.ts#L4) +[src/helpers/test-utils/functions/expect.ts:4](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/helpers/test-utils/functions/expect.ts#L4) ___ @@ -174,7 +174,7 @@ ___ #### Defined in -[src/helpers/test-utils/wrapper/getMockProvider.ts:6](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/helpers/test-utils/wrapper/getMockProvider.ts#L6) +[src/helpers/test-utils/wrapper/getMockProvider.ts:6](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/helpers/test-utils/wrapper/getMockProvider.ts#L6) ___ @@ -188,7 +188,7 @@ ___ #### Defined in -[src/helpers/test-utils/wrapper/hardhatTestHelpers.ts:4](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/helpers/test-utils/wrapper/hardhatTestHelpers.ts#L4) +[src/helpers/test-utils/wrapper/hardhatTestHelpers.ts:4](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/helpers/test-utils/wrapper/hardhatTestHelpers.ts#L4) ___ @@ -202,7 +202,7 @@ ___ #### Defined in -[src/helpers/test-utils/wrapper/hardhatTestHelpers.ts:12](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/helpers/test-utils/wrapper/hardhatTestHelpers.ts#L12) +[src/helpers/test-utils/wrapper/hardhatTestHelpers.ts:12](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/helpers/test-utils/wrapper/hardhatTestHelpers.ts#L12) ___ @@ -234,7 +234,7 @@ Created a test hook with a Web3Wrapper #### Defined in -[src/helpers/test-utils/wrapper/testWrapper.tsx:28](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/helpers/test-utils/wrapper/testWrapper.tsx#L28) +[src/helpers/test-utils/wrapper/testWrapper.tsx:28](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/helpers/test-utils/wrapper/testWrapper.tsx#L28) ___ @@ -254,7 +254,7 @@ ___ #### Defined in -[src/helpers/test-utils/wrapper/wrapperHelpers.ts:6](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/helpers/test-utils/wrapper/wrapperHelpers.ts#L6) +[src/helpers/test-utils/wrapper/wrapperHelpers.ts:6](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/helpers/test-utils/wrapper/wrapperHelpers.ts#L6) ___ @@ -274,7 +274,7 @@ ___ #### Defined in -[src/helpers/test-utils/wrapper/wrapperHelpers.ts:15](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/helpers/test-utils/wrapper/wrapperHelpers.ts#L15) +[src/helpers/test-utils/wrapper/wrapperHelpers.ts:15](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/helpers/test-utils/wrapper/wrapperHelpers.ts#L15) ___ @@ -295,7 +295,7 @@ ___ #### Defined in -[src/helpers/test-utils/wrapper/wrapperHelpers.ts:26](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/helpers/test-utils/wrapper/wrapperHelpers.ts#L26) +[src/helpers/test-utils/wrapper/wrapperHelpers.ts:26](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/helpers/test-utils/wrapper/wrapperHelpers.ts#L26) ___ @@ -316,7 +316,7 @@ ___ #### Defined in -[src/helpers/test-utils/wrapper/wrapperHelpers.ts:36](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/helpers/test-utils/wrapper/wrapperHelpers.ts#L36) +[src/helpers/test-utils/wrapper/wrapperHelpers.ts:36](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/helpers/test-utils/wrapper/wrapperHelpers.ts#L36) ## Type aliases @@ -332,4 +332,4 @@ ___ #### Defined in -[src/helpers/test-utils/wrapper/testWrapper.tsx:14](https://github.com/scaffold-eth/eth-hooks/blob/bddaee9/src/helpers/test-utils/wrapper/testWrapper.tsx#L14) +[src/helpers/test-utils/wrapper/testWrapper.tsx:14](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/helpers/test-utils/wrapper/testWrapper.tsx#L14) From e1d9ced94a15e0b873369ce9589ba6b87c934292 Mon Sep 17 00:00:00 2001 From: Shravan Sunder Date: Fri, 14 Jan 2022 19:59:54 -0500 Subject: [PATCH 04/21] Create CNAME --- docs/CNAME | 1 + 1 file changed, 1 insertion(+) create mode 100644 docs/CNAME diff --git a/docs/CNAME b/docs/CNAME new file mode 100644 index 00000000..bee0a640 --- /dev/null +++ b/docs/CNAME @@ -0,0 +1 @@ +eth-hooks.dev \ No newline at end of file From 6905d27f1e9a4abfb65b1ded66b8f4a028e043b1 Mon Sep 17 00:00:00 2001 From: Shravan Sunder Date: Fri, 14 Jan 2022 20:00:09 -0500 Subject: [PATCH 05/21] Delete CNAME --- docs/CNAME | 1 - 1 file changed, 1 deletion(-) delete mode 100644 docs/CNAME diff --git a/docs/CNAME b/docs/CNAME deleted file mode 100644 index bee0a640..00000000 --- a/docs/CNAME +++ /dev/null @@ -1 +0,0 @@ -eth-hooks.dev \ No newline at end of file From a8ae5841327d3d7d9efa883fe616c3885e2a58ac Mon Sep 17 00:00:00 2001 From: Shravan Sunder Date: Fri, 14 Jan 2022 20:00:58 -0500 Subject: [PATCH 06/21] Set theme jekyll-theme-minimal --- docs/_config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/_config.yml b/docs/_config.yml index c7418817..2f7efbea 100644 --- a/docs/_config.yml +++ b/docs/_config.yml @@ -1 +1 @@ -theme: jekyll-theme-slate \ No newline at end of file +theme: jekyll-theme-minimal \ No newline at end of file From 4109257a914c11d498a817159dffeb30556d255e Mon Sep 17 00:00:00 2001 From: Shravan Sunder Date: Fri, 14 Jan 2022 20:03:59 -0500 Subject: [PATCH 07/21] Set theme jekyll-theme-architect --- docs/_config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/_config.yml b/docs/_config.yml index 2f7efbea..3397c9a4 100644 --- a/docs/_config.yml +++ b/docs/_config.yml @@ -1 +1 @@ -theme: jekyll-theme-minimal \ No newline at end of file +theme: jekyll-theme-architect \ No newline at end of file From 70ea0283695bc91d80edd4b89bd0054137176109 Mon Sep 17 00:00:00 2001 From: Shravan Sunder Date: Fri, 14 Jan 2022 20:05:37 -0500 Subject: [PATCH 08/21] Set theme jekyll-theme-midnight --- docs/_config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/_config.yml b/docs/_config.yml index 3397c9a4..18854876 100644 --- a/docs/_config.yml +++ b/docs/_config.yml @@ -1 +1 @@ -theme: jekyll-theme-architect \ No newline at end of file +theme: jekyll-theme-midnight \ No newline at end of file From 622825e5c774e0a4859129cd51af4179b44e821b Mon Sep 17 00:00:00 2001 From: Shravan Sunder Date: Fri, 14 Jan 2022 20:07:35 -0500 Subject: [PATCH 09/21] Set theme jekyll-theme-modernist --- docs/_config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/_config.yml b/docs/_config.yml index 18854876..cc35c1df 100644 --- a/docs/_config.yml +++ b/docs/_config.yml @@ -1 +1 @@ -theme: jekyll-theme-midnight \ No newline at end of file +theme: jekyll-theme-modernist \ No newline at end of file From 4b605c9cc97699bcb9ae8c49332427ae11492d98 Mon Sep 17 00:00:00 2001 From: Shravan Sunder Date: Fri, 14 Jan 2022 20:08:37 -0500 Subject: [PATCH 10/21] Set theme jekyll-theme-hacker --- docs/_config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/_config.yml b/docs/_config.yml index cc35c1df..fc24e7a6 100644 --- a/docs/_config.yml +++ b/docs/_config.yml @@ -1 +1 @@ -theme: jekyll-theme-modernist \ No newline at end of file +theme: jekyll-theme-hacker \ No newline at end of file From 257b4dba9926de106bceba1ebb2bdab713ada95a Mon Sep 17 00:00:00 2001 From: Shravan Sunder Date: Fri, 14 Jan 2022 20:09:58 -0500 Subject: [PATCH 11/21] Set theme jekyll-theme-architect --- docs/_config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/_config.yml b/docs/_config.yml index fc24e7a6..3397c9a4 100644 --- a/docs/_config.yml +++ b/docs/_config.yml @@ -1 +1 @@ -theme: jekyll-theme-hacker \ No newline at end of file +theme: jekyll-theme-architect \ No newline at end of file From 870e1ffb23bdc24fba398a874addbdd4404d9a87 Mon Sep 17 00:00:00 2001 From: Shravan Sunder Date: Fri, 14 Jan 2022 20:27:53 -0500 Subject: [PATCH 12/21] #124 updated docs headers --- README.md | 2 + docs/README.md | 4 +- .../EthersContext.CouldNotActivateError.md | 2 +- .../EthersContext.EthersModalConnector.md | 58 +++++++-------- ...ersContext.NoEthereumProviderFoundError.md | 2 +- .../EthersContext.UserClosedModalError.md | 2 +- .../classes/TestUtils.MockConnector.md | 44 +++++------ .../EthersContext.ICommonModalConnector.md | 10 +-- ....IStaticJsonRpcProviderConnectorOptions.md | 4 +- .../interfaces/Models.IEthersContext.md | 20 ++--- docs/api-typedocs/modules/EthersContext.md | 40 +++++----- docs/api-typedocs/modules/Helpers.md | 2 +- docs/api-typedocs/modules/Hooks.md | 74 +++++++++---------- docs/api-typedocs/modules/Models.md | 70 +++++++++--------- docs/api-typedocs/modules/TestUtils.md | 34 ++++----- package.json | 1 + src/context/ethers/BlockNumberContext.tsx | 4 +- src/context/ethers/EthersAppContext.tsx | 4 +- .../ethers/connectors/EthersModalConnector.ts | 8 +- .../StaticJsonRpcProviderConnector.ts | 2 +- src/hooks/dapps/useDexEthPrice.ts | 2 +- src/hooks/erc/useTokenBalance.ts | 2 +- src/hooks/useBalance.ts | 2 +- src/hooks/useBlockNumber.ts | 4 +- src/hooks/useBurnerSigner.ts | 2 +- src/hooks/useContractExistsAtAddress.ts | 2 +- src/hooks/useContractLoader.ts | 2 +- src/hooks/useContractReader.ts | 4 +- src/hooks/useEventListener.ts | 2 +- src/hooks/useGasPrice.ts | 2 +- src/hooks/useNonce.ts | 2 +- src/hooks/useTimestamp.ts | 2 +- src/models/ethersAppContextTypes.ts | 2 +- src/models/hookOptions.ts | 4 +- src/models/providerTypes.ts | 2 +- yarn.lock | 19 +++++ 36 files changed, 233 insertions(+), 209 deletions(-) diff --git a/README.md b/README.md index b595ad34..65826cdc 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,9 @@ Commonly used Ethereum hooks. Used by 🏗 [scaffold-eth](https://github.com/scaffold-eth/scaffold-eth) + Used by 🏭 [scaffold-eth-typescript](https://github.com/scaffold-eth/scaffold-eth-typescript) + Used by ⚙ [eth-components](https://github.com/scaffold-eth/eth-components) Created by 🏰 [BuidlGuidl.eth](https://BuidlGuidl.com) diff --git a/docs/README.md b/docs/README.md index 140d77f2..154fa52e 100644 --- a/docs/README.md +++ b/docs/README.md @@ -3,9 +3,11 @@ Commonly used Ethereum hooks. Used by 🏗 [scaffold-eth](https://github.com/scaffold-eth/scaffold-eth) + Used by ⚙ [eth-components](https://github.com/scaffold-eth/eth-components) + Created by 🏰 [BuidlGuidl.eth](https://BuidlGuidl.com) -# API Docs +# Eth-Hooks API [Eth-Hooks API Overview](./api-typedocs/api-overview.md) diff --git a/docs/api-typedocs/classes/EthersContext.CouldNotActivateError.md b/docs/api-typedocs/classes/EthersContext.CouldNotActivateError.md index d8ca6529..38afbd67 100644 --- a/docs/api-typedocs/classes/EthersContext.CouldNotActivateError.md +++ b/docs/api-typedocs/classes/EthersContext.CouldNotActivateError.md @@ -162,4 +162,4 @@ Error.constructor #### Defined in -[src/context/ethers/connectors/connectorErrors.ts:16](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/context/ethers/connectors/connectorErrors.ts#L16) +[src/context/ethers/connectors/connectorErrors.ts:16](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/context/ethers/connectors/connectorErrors.ts#L16) diff --git a/docs/api-typedocs/classes/EthersContext.EthersModalConnector.md b/docs/api-typedocs/classes/EthersContext.EthersModalConnector.md index f51fe359..e12cc34f 100644 --- a/docs/api-typedocs/classes/EthersContext.EthersModalConnector.md +++ b/docs/api-typedocs/classes/EthersContext.EthersModalConnector.md @@ -8,11 +8,11 @@ This is a connector for [web3-react](https://github.com/NoahZinsmeister/web3-react) that allows it to interface with [web3Modal](https://github.com/Web3Modal/web3modal). The provider selected by user via web3modal is interfaced to the web3-react context. -#### Features +##### Features - This connector used with [useEthersContext](../modules/EthersContext.md#useetherscontext) allows the app and all the hooks to effortlessly access the current network, provider, signer, address information [IEthersContext](../interfaces/Models.IEthersContext.md) - The connector centralizes and takes care of management of the web3 interaction and provides a consistent exprience for your app. -#### Notes +##### Notes - inherits from web3-react class AbstractConnector ## Hierarchy @@ -1131,7 +1131,7 @@ ___ #### Defined in -[src/context/ethers/connectors/EthersModalConnector.ts:76](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/context/ethers/connectors/EthersModalConnector.ts#L76) +[src/context/ethers/connectors/EthersModalConnector.ts:76](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/context/ethers/connectors/EthersModalConnector.ts#L76) ___ @@ -1151,7 +1151,7 @@ ___ #### Defined in -[src/context/ethers/connectors/EthersModalConnector.ts:106](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/context/ethers/connectors/EthersModalConnector.ts#L106) +[src/context/ethers/connectors/EthersModalConnector.ts:106](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/context/ethers/connectors/EthersModalConnector.ts#L106) ___ @@ -1165,7 +1165,7 @@ ___ #### Defined in -[src/context/ethers/connectors/EthersModalConnector.ts:154](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/context/ethers/connectors/EthersModalConnector.ts#L154) +[src/context/ethers/connectors/EthersModalConnector.ts:154](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/context/ethers/connectors/EthersModalConnector.ts#L154) ___ @@ -1176,13 +1176,13 @@ ___ #### Summary Inherits from AbstractConnector. This activates web3Modal and opens the modal. -#### Notes +##### Notes Once the user selects a provider - this will activate the provider and attach the appropriate event listeners. - get the account and signer - gets the ethers compatable provider -#### Errors +##### Errors - [UserClosedModalError](EthersContext.UserClosedModalError.md) - [CouldNotActivateError](EthersContext.CouldNotActivateError.md) @@ -1196,7 +1196,7 @@ AbstractConnector.activate #### Defined in -[src/context/ethers/connectors/EthersModalConnector.ts:175](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/context/ethers/connectors/EthersModalConnector.ts#L175) +[src/context/ethers/connectors/EthersModalConnector.ts:175](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/context/ethers/connectors/EthersModalConnector.ts#L175) ___ @@ -1217,7 +1217,7 @@ AbstractConnector.deactivate #### Defined in -[src/context/ethers/connectors/EthersModalConnector.ts:233](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/context/ethers/connectors/EthersModalConnector.ts#L233) +[src/context/ethers/connectors/EthersModalConnector.ts:233](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/context/ethers/connectors/EthersModalConnector.ts#L233) ___ @@ -1235,7 +1235,7 @@ AbstractConnector.getProvider #### Defined in -[src/context/ethers/connectors/EthersModalConnector.ts:253](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/context/ethers/connectors/EthersModalConnector.ts#L253) +[src/context/ethers/connectors/EthersModalConnector.ts:253](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/context/ethers/connectors/EthersModalConnector.ts#L253) ___ @@ -1253,7 +1253,7 @@ AbstractConnector.getChainId #### Defined in -[src/context/ethers/connectors/EthersModalConnector.ts:257](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/context/ethers/connectors/EthersModalConnector.ts#L257) +[src/context/ethers/connectors/EthersModalConnector.ts:257](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/context/ethers/connectors/EthersModalConnector.ts#L257) ___ @@ -1271,7 +1271,7 @@ AbstractConnector.getAccount #### Defined in -[src/context/ethers/connectors/EthersModalConnector.ts:267](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/context/ethers/connectors/EthersModalConnector.ts#L267) +[src/context/ethers/connectors/EthersModalConnector.ts:267](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/context/ethers/connectors/EthersModalConnector.ts#L267) ___ @@ -1289,7 +1289,7 @@ ___ #### Defined in -[src/context/ethers/connectors/EthersModalConnector.ts:279](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/context/ethers/connectors/EthersModalConnector.ts#L279) +[src/context/ethers/connectors/EthersModalConnector.ts:279](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/context/ethers/connectors/EthersModalConnector.ts#L279) ___ @@ -1303,7 +1303,7 @@ ___ #### Defined in -[src/context/ethers/connectors/EthersModalConnector.ts:283](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/context/ethers/connectors/EthersModalConnector.ts#L283) +[src/context/ethers/connectors/EthersModalConnector.ts:283](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/context/ethers/connectors/EthersModalConnector.ts#L283) ___ @@ -1330,7 +1330,7 @@ Change the current signer and account used by the connector #### Defined in -[src/context/ethers/connectors/EthersModalConnector.ts:294](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/context/ethers/connectors/EthersModalConnector.ts#L294) +[src/context/ethers/connectors/EthersModalConnector.ts:294](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/context/ethers/connectors/EthersModalConnector.ts#L294) ___ @@ -1344,7 +1344,7 @@ ___ #### Defined in -[src/context/ethers/connectors/EthersModalConnector.ts:305](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/context/ethers/connectors/EthersModalConnector.ts#L305) +[src/context/ethers/connectors/EthersModalConnector.ts:305](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/context/ethers/connectors/EthersModalConnector.ts#L305) ___ @@ -1365,7 +1365,7 @@ Resets the web3Modal and clears the cache #### Defined in -[src/context/ethers/connectors/EthersModalConnector.ts:313](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/context/ethers/connectors/EthersModalConnector.ts#L313) +[src/context/ethers/connectors/EthersModalConnector.ts:313](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/context/ethers/connectors/EthersModalConnector.ts#L313) ___ @@ -1392,7 +1392,7 @@ Sets the web3modal theme: light | dark | ThemeColors #### Defined in -[src/context/ethers/connectors/EthersModalConnector.ts:328](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/context/ethers/connectors/EthersModalConnector.ts#L328) +[src/context/ethers/connectors/EthersModalConnector.ts:328](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/context/ethers/connectors/EthersModalConnector.ts#L328) ## Properties @@ -1482,7 +1482,7 @@ ___ #### Defined in -[src/context/ethers/connectors/EthersModalConnector.ts:62](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/context/ethers/connectors/EthersModalConnector.ts#L62) +[src/context/ethers/connectors/EthersModalConnector.ts:62](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/context/ethers/connectors/EthersModalConnector.ts#L62) ___ @@ -1492,7 +1492,7 @@ ___ #### Defined in -[src/context/ethers/connectors/EthersModalConnector.ts:63](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/context/ethers/connectors/EthersModalConnector.ts#L63) +[src/context/ethers/connectors/EthersModalConnector.ts:63](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/context/ethers/connectors/EthersModalConnector.ts#L63) ___ @@ -1502,7 +1502,7 @@ ___ #### Defined in -[src/context/ethers/connectors/EthersModalConnector.ts:64](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/context/ethers/connectors/EthersModalConnector.ts#L64) +[src/context/ethers/connectors/EthersModalConnector.ts:64](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/context/ethers/connectors/EthersModalConnector.ts#L64) ___ @@ -1512,7 +1512,7 @@ ___ #### Defined in -[src/context/ethers/connectors/EthersModalConnector.ts:65](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/context/ethers/connectors/EthersModalConnector.ts#L65) +[src/context/ethers/connectors/EthersModalConnector.ts:65](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/context/ethers/connectors/EthersModalConnector.ts#L65) ___ @@ -1522,7 +1522,7 @@ ___ #### Defined in -[src/context/ethers/connectors/EthersModalConnector.ts:66](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/context/ethers/connectors/EthersModalConnector.ts#L66) +[src/context/ethers/connectors/EthersModalConnector.ts:66](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/context/ethers/connectors/EthersModalConnector.ts#L66) ___ @@ -1532,7 +1532,7 @@ ___ #### Defined in -[src/context/ethers/connectors/EthersModalConnector.ts:67](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/context/ethers/connectors/EthersModalConnector.ts#L67) +[src/context/ethers/connectors/EthersModalConnector.ts:67](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/context/ethers/connectors/EthersModalConnector.ts#L67) ___ @@ -1542,7 +1542,7 @@ ___ #### Defined in -[src/context/ethers/connectors/EthersModalConnector.ts:68](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/context/ethers/connectors/EthersModalConnector.ts#L68) +[src/context/ethers/connectors/EthersModalConnector.ts:68](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/context/ethers/connectors/EthersModalConnector.ts#L68) ___ @@ -1552,7 +1552,7 @@ ___ #### Defined in -[src/context/ethers/connectors/EthersModalConnector.ts:69](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/context/ethers/connectors/EthersModalConnector.ts#L69) +[src/context/ethers/connectors/EthersModalConnector.ts:69](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/context/ethers/connectors/EthersModalConnector.ts#L69) ___ @@ -1562,7 +1562,7 @@ ___ #### Defined in -[src/context/ethers/connectors/EthersModalConnector.ts:70](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/context/ethers/connectors/EthersModalConnector.ts#L70) +[src/context/ethers/connectors/EthersModalConnector.ts:70](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/context/ethers/connectors/EthersModalConnector.ts#L70) ## Constructors @@ -1585,7 +1585,7 @@ AbstractConnector.constructor #### Defined in -[src/context/ethers/connectors/EthersModalConnector.ts:86](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/context/ethers/connectors/EthersModalConnector.ts#L86) +[src/context/ethers/connectors/EthersModalConnector.ts:86](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/context/ethers/connectors/EthersModalConnector.ts#L86) ## Accessors @@ -1599,4 +1599,4 @@ AbstractConnector.constructor #### Defined in -[src/context/ethers/connectors/EthersModalConnector.ts:72](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/context/ethers/connectors/EthersModalConnector.ts#L72) +[src/context/ethers/connectors/EthersModalConnector.ts:72](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/context/ethers/connectors/EthersModalConnector.ts#L72) diff --git a/docs/api-typedocs/classes/EthersContext.NoEthereumProviderFoundError.md b/docs/api-typedocs/classes/EthersContext.NoEthereumProviderFoundError.md index e6c9f259..dbe1f8eb 100644 --- a/docs/api-typedocs/classes/EthersContext.NoEthereumProviderFoundError.md +++ b/docs/api-typedocs/classes/EthersContext.NoEthereumProviderFoundError.md @@ -156,4 +156,4 @@ Error.constructor #### Defined in -[src/context/ethers/connectors/connectorErrors.ts:27](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/context/ethers/connectors/connectorErrors.ts#L27) +[src/context/ethers/connectors/connectorErrors.ts:27](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/context/ethers/connectors/connectorErrors.ts#L27) diff --git a/docs/api-typedocs/classes/EthersContext.UserClosedModalError.md b/docs/api-typedocs/classes/EthersContext.UserClosedModalError.md index bc1488ce..34b259f5 100644 --- a/docs/api-typedocs/classes/EthersContext.UserClosedModalError.md +++ b/docs/api-typedocs/classes/EthersContext.UserClosedModalError.md @@ -156,4 +156,4 @@ Error.constructor #### Defined in -[src/context/ethers/connectors/connectorErrors.ts:5](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/context/ethers/connectors/connectorErrors.ts#L5) +[src/context/ethers/connectors/connectorErrors.ts:5](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/context/ethers/connectors/connectorErrors.ts#L5) diff --git a/docs/api-typedocs/classes/TestUtils.MockConnector.md b/docs/api-typedocs/classes/TestUtils.MockConnector.md index 1595251f..27b501ee 100644 --- a/docs/api-typedocs/classes/TestUtils.MockConnector.md +++ b/docs/api-typedocs/classes/TestUtils.MockConnector.md @@ -1110,7 +1110,7 @@ ___ #### Defined in -[src/helpers/test-utils/wrapper/MockConnector.ts:33](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/helpers/test-utils/wrapper/MockConnector.ts#L33) +[src/helpers/test-utils/wrapper/MockConnector.ts:33](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/helpers/test-utils/wrapper/MockConnector.ts#L33) ___ @@ -1128,7 +1128,7 @@ ___ #### Defined in -[src/helpers/test-utils/wrapper/MockConnector.ts:39](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/helpers/test-utils/wrapper/MockConnector.ts#L39) +[src/helpers/test-utils/wrapper/MockConnector.ts:39](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/helpers/test-utils/wrapper/MockConnector.ts#L39) ___ @@ -1146,7 +1146,7 @@ ___ #### Defined in -[src/helpers/test-utils/wrapper/MockConnector.ts:43](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/helpers/test-utils/wrapper/MockConnector.ts#L43) +[src/helpers/test-utils/wrapper/MockConnector.ts:43](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/helpers/test-utils/wrapper/MockConnector.ts#L43) ___ @@ -1170,7 +1170,7 @@ ___ #### Defined in -[src/helpers/test-utils/wrapper/MockConnector.ts:46](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/helpers/test-utils/wrapper/MockConnector.ts#L46) +[src/helpers/test-utils/wrapper/MockConnector.ts:46](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/helpers/test-utils/wrapper/MockConnector.ts#L46) ___ @@ -1188,7 +1188,7 @@ ___ #### Defined in -[src/helpers/test-utils/wrapper/MockConnector.ts:49](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/helpers/test-utils/wrapper/MockConnector.ts#L49) +[src/helpers/test-utils/wrapper/MockConnector.ts:49](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/helpers/test-utils/wrapper/MockConnector.ts#L49) ___ @@ -1212,7 +1212,7 @@ ___ #### Defined in -[src/helpers/test-utils/wrapper/MockConnector.ts:53](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/helpers/test-utils/wrapper/MockConnector.ts#L53) +[src/helpers/test-utils/wrapper/MockConnector.ts:53](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/helpers/test-utils/wrapper/MockConnector.ts#L53) ___ @@ -1230,7 +1230,7 @@ AbstractConnector.activate #### Defined in -[src/helpers/test-utils/wrapper/MockConnector.ts:61](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/helpers/test-utils/wrapper/MockConnector.ts#L61) +[src/helpers/test-utils/wrapper/MockConnector.ts:61](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/helpers/test-utils/wrapper/MockConnector.ts#L61) ___ @@ -1248,7 +1248,7 @@ AbstractConnector.getProvider #### Defined in -[src/helpers/test-utils/wrapper/MockConnector.ts:69](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/helpers/test-utils/wrapper/MockConnector.ts#L69) +[src/helpers/test-utils/wrapper/MockConnector.ts:69](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/helpers/test-utils/wrapper/MockConnector.ts#L69) ___ @@ -1266,7 +1266,7 @@ AbstractConnector.getChainId #### Defined in -[src/helpers/test-utils/wrapper/MockConnector.ts:73](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/helpers/test-utils/wrapper/MockConnector.ts#L73) +[src/helpers/test-utils/wrapper/MockConnector.ts:73](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/helpers/test-utils/wrapper/MockConnector.ts#L73) ___ @@ -1284,7 +1284,7 @@ AbstractConnector.getAccount #### Defined in -[src/helpers/test-utils/wrapper/MockConnector.ts:77](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/helpers/test-utils/wrapper/MockConnector.ts#L77) +[src/helpers/test-utils/wrapper/MockConnector.ts:77](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/helpers/test-utils/wrapper/MockConnector.ts#L77) ___ @@ -1304,7 +1304,7 @@ ___ #### Defined in -[src/helpers/test-utils/wrapper/MockConnector.ts:82](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/helpers/test-utils/wrapper/MockConnector.ts#L82) +[src/helpers/test-utils/wrapper/MockConnector.ts:82](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/helpers/test-utils/wrapper/MockConnector.ts#L82) ___ @@ -1322,7 +1322,7 @@ AbstractConnector.deactivate #### Defined in -[src/helpers/test-utils/wrapper/MockConnector.ts:87](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/helpers/test-utils/wrapper/MockConnector.ts#L87) +[src/helpers/test-utils/wrapper/MockConnector.ts:87](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/helpers/test-utils/wrapper/MockConnector.ts#L87) ## Properties @@ -1412,7 +1412,7 @@ ___ #### Defined in -[src/helpers/test-utils/wrapper/MockConnector.ts:14](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/helpers/test-utils/wrapper/MockConnector.ts#L14) +[src/helpers/test-utils/wrapper/MockConnector.ts:14](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/helpers/test-utils/wrapper/MockConnector.ts#L14) ___ @@ -1422,7 +1422,7 @@ ___ #### Defined in -[src/helpers/test-utils/wrapper/MockConnector.ts:15](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/helpers/test-utils/wrapper/MockConnector.ts#L15) +[src/helpers/test-utils/wrapper/MockConnector.ts:15](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/helpers/test-utils/wrapper/MockConnector.ts#L15) ___ @@ -1432,7 +1432,7 @@ ___ #### Defined in -[src/helpers/test-utils/wrapper/MockConnector.ts:17](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/helpers/test-utils/wrapper/MockConnector.ts#L17) +[src/helpers/test-utils/wrapper/MockConnector.ts:17](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/helpers/test-utils/wrapper/MockConnector.ts#L17) ___ @@ -1442,7 +1442,7 @@ ___ #### Defined in -[src/helpers/test-utils/wrapper/MockConnector.ts:18](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/helpers/test-utils/wrapper/MockConnector.ts#L18) +[src/helpers/test-utils/wrapper/MockConnector.ts:18](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/helpers/test-utils/wrapper/MockConnector.ts#L18) ___ @@ -1452,7 +1452,7 @@ ___ #### Defined in -[src/helpers/test-utils/wrapper/MockConnector.ts:20](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/helpers/test-utils/wrapper/MockConnector.ts#L20) +[src/helpers/test-utils/wrapper/MockConnector.ts:20](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/helpers/test-utils/wrapper/MockConnector.ts#L20) ___ @@ -1462,7 +1462,7 @@ ___ #### Defined in -[src/helpers/test-utils/wrapper/MockConnector.ts:21](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/helpers/test-utils/wrapper/MockConnector.ts#L21) +[src/helpers/test-utils/wrapper/MockConnector.ts:21](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/helpers/test-utils/wrapper/MockConnector.ts#L21) ___ @@ -1472,7 +1472,7 @@ ___ #### Defined in -[src/helpers/test-utils/wrapper/MockConnector.ts:22](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/helpers/test-utils/wrapper/MockConnector.ts#L22) +[src/helpers/test-utils/wrapper/MockConnector.ts:22](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/helpers/test-utils/wrapper/MockConnector.ts#L22) ___ @@ -1482,7 +1482,7 @@ ___ #### Defined in -[src/helpers/test-utils/wrapper/MockConnector.ts:23](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/helpers/test-utils/wrapper/MockConnector.ts#L23) +[src/helpers/test-utils/wrapper/MockConnector.ts:23](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/helpers/test-utils/wrapper/MockConnector.ts#L23) ___ @@ -1492,7 +1492,7 @@ ___ #### Defined in -[src/helpers/test-utils/wrapper/MockConnector.ts:24](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/helpers/test-utils/wrapper/MockConnector.ts#L24) +[src/helpers/test-utils/wrapper/MockConnector.ts:24](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/helpers/test-utils/wrapper/MockConnector.ts#L24) ## Constructors @@ -1512,4 +1512,4 @@ AbstractConnector.constructor #### Defined in -[src/helpers/test-utils/wrapper/MockConnector.ts:26](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/helpers/test-utils/wrapper/MockConnector.ts#L26) +[src/helpers/test-utils/wrapper/MockConnector.ts:26](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/helpers/test-utils/wrapper/MockConnector.ts#L26) diff --git a/docs/api-typedocs/interfaces/EthersContext.ICommonModalConnector.md b/docs/api-typedocs/interfaces/EthersContext.ICommonModalConnector.md index f9618ceb..b403e260 100644 --- a/docs/api-typedocs/interfaces/EthersContext.ICommonModalConnector.md +++ b/docs/api-typedocs/interfaces/EthersContext.ICommonModalConnector.md @@ -34,7 +34,7 @@ An interface implemented by [EthersModalConnector](../classes/EthersContext.Ethe #### Defined in -[src/context/ethers/connectors/EthersModalConnector.ts:38](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/context/ethers/connectors/EthersModalConnector.ts#L38) +[src/context/ethers/connectors/EthersModalConnector.ts:38](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/context/ethers/connectors/EthersModalConnector.ts#L38) ___ @@ -54,7 +54,7 @@ ___ #### Defined in -[src/context/ethers/connectors/EthersModalConnector.ts:39](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/context/ethers/connectors/EthersModalConnector.ts#L39) +[src/context/ethers/connectors/EthersModalConnector.ts:39](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/context/ethers/connectors/EthersModalConnector.ts#L39) ___ @@ -68,7 +68,7 @@ ___ #### Defined in -[src/context/ethers/connectors/EthersModalConnector.ts:40](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/context/ethers/connectors/EthersModalConnector.ts#L40) +[src/context/ethers/connectors/EthersModalConnector.ts:40](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/context/ethers/connectors/EthersModalConnector.ts#L40) ___ @@ -88,7 +88,7 @@ ___ #### Defined in -[src/context/ethers/connectors/EthersModalConnector.ts:41](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/context/ethers/connectors/EthersModalConnector.ts#L41) +[src/context/ethers/connectors/EthersModalConnector.ts:41](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/context/ethers/connectors/EthersModalConnector.ts#L41) ___ @@ -102,4 +102,4 @@ ___ #### Defined in -[src/context/ethers/connectors/EthersModalConnector.ts:42](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/context/ethers/connectors/EthersModalConnector.ts#L42) +[src/context/ethers/connectors/EthersModalConnector.ts:42](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/context/ethers/connectors/EthersModalConnector.ts#L42) diff --git a/docs/api-typedocs/interfaces/EthersContext.IStaticJsonRpcProviderConnectorOptions.md b/docs/api-typedocs/interfaces/EthersContext.IStaticJsonRpcProviderConnectorOptions.md index 84890f29..3cae5e2f 100644 --- a/docs/api-typedocs/interfaces/EthersContext.IStaticJsonRpcProviderConnectorOptions.md +++ b/docs/api-typedocs/interfaces/EthersContext.IStaticJsonRpcProviderConnectorOptions.md @@ -48,7 +48,7 @@ ___ #### Defined in -[src/context/ethers/connectors/StaticJsonRpcProviderConnector.ts:12](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/context/ethers/connectors/StaticJsonRpcProviderConnector.ts#L12) +[src/context/ethers/connectors/StaticJsonRpcProviderConnector.ts:12](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/context/ethers/connectors/StaticJsonRpcProviderConnector.ts#L12) ___ @@ -58,4 +58,4 @@ ___ #### Defined in -[src/context/ethers/connectors/StaticJsonRpcProviderConnector.ts:13](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/context/ethers/connectors/StaticJsonRpcProviderConnector.ts#L13) +[src/context/ethers/connectors/StaticJsonRpcProviderConnector.ts:13](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/context/ethers/connectors/StaticJsonRpcProviderConnector.ts#L13) diff --git a/docs/api-typedocs/interfaces/Models.IEthersContext.md b/docs/api-typedocs/interfaces/Models.IEthersContext.md index 93ee7c83..6f7d59d8 100644 --- a/docs/api-typedocs/interfaces/Models.IEthersContext.md +++ b/docs/api-typedocs/interfaces/Models.IEthersContext.md @@ -126,7 +126,7 @@ ___ #### Defined in -[src/models/ethersAppContextTypes.ts:37](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/models/ethersAppContextTypes.ts#L37) +[src/models/ethersAppContextTypes.ts:37](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/models/ethersAppContextTypes.ts#L37) ___ @@ -140,7 +140,7 @@ ___ #### Defined in -[src/models/ethersAppContextTypes.ts:38](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/models/ethersAppContextTypes.ts#L38) +[src/models/ethersAppContextTypes.ts:38](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/models/ethersAppContextTypes.ts#L38) ## Properties @@ -182,7 +182,7 @@ Web3ReactContextInterface.connector #### Defined in -[src/models/ethersAppContextTypes.ts:30](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/models/ethersAppContextTypes.ts#L30) +[src/models/ethersAppContextTypes.ts:30](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/models/ethersAppContextTypes.ts#L30) ___ @@ -192,7 +192,7 @@ ___ #### Defined in -[src/models/ethersAppContextTypes.ts:31](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/models/ethersAppContextTypes.ts#L31) +[src/models/ethersAppContextTypes.ts:31](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/models/ethersAppContextTypes.ts#L31) ___ @@ -206,7 +206,7 @@ Web3ReactContextInterface.active #### Defined in -[src/models/ethersAppContextTypes.ts:32](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/models/ethersAppContextTypes.ts#L32) +[src/models/ethersAppContextTypes.ts:32](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/models/ethersAppContextTypes.ts#L32) ___ @@ -216,7 +216,7 @@ ___ #### Defined in -[src/models/ethersAppContextTypes.ts:33](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/models/ethersAppContextTypes.ts#L33) +[src/models/ethersAppContextTypes.ts:33](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/models/ethersAppContextTypes.ts#L33) ___ @@ -230,7 +230,7 @@ Web3ReactContextInterface.account #### Defined in -[src/models/ethersAppContextTypes.ts:34](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/models/ethersAppContextTypes.ts#L34) +[src/models/ethersAppContextTypes.ts:34](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/models/ethersAppContextTypes.ts#L34) ___ @@ -244,7 +244,7 @@ Web3ReactContextInterface.chainId #### Defined in -[src/models/ethersAppContextTypes.ts:35](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/models/ethersAppContextTypes.ts#L35) +[src/models/ethersAppContextTypes.ts:35](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/models/ethersAppContextTypes.ts#L35) ___ @@ -254,7 +254,7 @@ ___ #### Defined in -[src/models/ethersAppContextTypes.ts:36](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/models/ethersAppContextTypes.ts#L36) +[src/models/ethersAppContextTypes.ts:36](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/models/ethersAppContextTypes.ts#L36) ___ @@ -264,4 +264,4 @@ ___ #### Defined in -[src/models/ethersAppContextTypes.ts:39](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/models/ethersAppContextTypes.ts#L39) +[src/models/ethersAppContextTypes.ts:39](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/models/ethersAppContextTypes.ts#L39) diff --git a/docs/api-typedocs/modules/EthersContext.md b/docs/api-typedocs/modules/EthersContext.md index bdfda6b9..d70591cf 100644 --- a/docs/api-typedocs/modules/EthersContext.md +++ b/docs/api-typedocs/modules/EthersContext.md @@ -61,11 +61,11 @@ A context for your react app with [useEthersContext](EthersContext.md#useethersc A hook that gets you the current blocknumber via react context - can be shared by your whole app. -#### Use +##### Use Make sure to wrap your main app with the [EthersAppContext](EthersContext.md#ethersappcontext). - See [scaffold-eth-typescript example](https://github.com/scaffold-eth/scaffold-eth-typescript/blob/0225179a2a8bb7b3a255d6eff4802b47d72809dd/packages/vite-app-ts/src/components/routes/App.tsx#L38) -#### Notes +##### Notes - this extensively used by eth-hooks to trigger hooks when a new block arrives - uses the current provider {@link ethersProvider} from [useEthersContext](EthersContext.md#useetherscontext) @@ -77,7 +77,7 @@ current block number #### Defined in -[src/context/ethers/BlockNumberContext.tsx:64](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/context/ethers/BlockNumberContext.tsx#L64) +[src/context/ethers/BlockNumberContext.tsx:64](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/context/ethers/BlockNumberContext.tsx#L64) ___ @@ -89,14 +89,14 @@ ___ This Hook provides you with access to the current Ethers Provider Context. This provider would be the one selected by using [EthersModalConnector](../classes/EthersContext.EthersModalConnector.md) and Web3Modal -#### Features +##### Features Gives you access to consistent interface to get the current provider information [EthersModalConnector](../classes/EthersContext.EthersModalConnector.md) - ethers compatable provider [TEthersProvider](Models.md#tethersprovider) - a callback to change the current account (signer) - the current account, chainId and signer - callbacks to open the web3Modal, logout or change theme -#### Notes +##### Notes - currently providerKey isnt being used #### Parameters @@ -111,7 +111,7 @@ Gives you access to consistent interface to get the current provider information #### Defined in -[src/context/ethers/EthersAppContext.tsx:37](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/context/ethers/EthersAppContext.tsx#L37) +[src/context/ethers/EthersAppContext.tsx:37](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/context/ethers/EthersAppContext.tsx#L37) ___ @@ -123,7 +123,7 @@ ___ A connector that can be used by apps to connect to a StaticJsonRpcProvider - For example you can use this to connect to a localhost provider -#### Notes +##### Notes See scaffold-eth-typescript for an example that uses it to connect to a localhost burner wallet. - [scaffold-eth-typescript example](https://github.com/scaffold-eth/scaffold-eth-typescript/blob/0225179a2a8bb7b3a255d6eff4802b47d72809dd/packages/vite-app-ts/src/config/web3ModalConfig.ts#L86) @@ -140,7 +140,7 @@ See scaffold-eth-typescript for an example that uses it to connect to a localhos #### Defined in -[src/context/ethers/connectors/StaticJsonRpcProviderConnector.ts:31](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/context/ethers/connectors/StaticJsonRpcProviderConnector.ts#L31) +[src/context/ethers/connectors/StaticJsonRpcProviderConnector.ts:31](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/context/ethers/connectors/StaticJsonRpcProviderConnector.ts#L31) ___ @@ -172,7 +172,7 @@ ___ #### Defined in -[src/context/app-contracts/contractConnectors.ts:44](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/context/app-contracts/contractConnectors.ts#L44) +[src/context/app-contracts/contractConnectors.ts:44](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/context/app-contracts/contractConnectors.ts#L44) ___ @@ -202,7 +202,7 @@ ___ #### Defined in -[src/context/app-contracts/contractConnectors.ts:74](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/context/app-contracts/contractConnectors.ts#L74) +[src/context/app-contracts/contractConnectors.ts:74](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/context/app-contracts/contractConnectors.ts#L74) ___ @@ -230,7 +230,7 @@ ___ #### Defined in -[src/context/app-contracts/contractConnectors.ts:104](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/context/app-contracts/contractConnectors.ts#L104) +[src/context/app-contracts/contractConnectors.ts:104](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/context/app-contracts/contractConnectors.ts#L104) ___ @@ -259,7 +259,7 @@ ___ #### Defined in -[src/context/app-contracts/contractConnectors.ts:120](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/context/app-contracts/contractConnectors.ts#L120) +[src/context/app-contracts/contractConnectors.ts:120](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/context/app-contracts/contractConnectors.ts#L120) ___ @@ -295,7 +295,7 @@ ___ #### Defined in -[src/context/app-contracts/contractsContextFactory.tsx:79](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/context/app-contracts/contractsContextFactory.tsx#L79) +[src/context/app-contracts/contractsContextFactory.tsx:79](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/context/app-contracts/contractsContextFactory.tsx#L79) ## Type aliases @@ -311,7 +311,7 @@ ___ #### Defined in -[src/context/app-contracts/contractsContextFactory.tsx:22](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/context/app-contracts/contractsContextFactory.tsx#L22) +[src/context/app-contracts/contractsContextFactory.tsx:22](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/context/app-contracts/contractsContextFactory.tsx#L22) ___ @@ -338,7 +338,7 @@ ___ #### Defined in -[src/context/app-contracts/contractsContextFactory.tsx:60](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/context/app-contracts/contractsContextFactory.tsx#L60) +[src/context/app-contracts/contractsContextFactory.tsx:60](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/context/app-contracts/contractsContextFactory.tsx#L60) ___ @@ -360,7 +360,7 @@ Props for context that allow you specify alternate web3ReactRoot [See docs](http #### Defined in -[src/context/ethers/EthersAppContext.tsx:97](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/context/ethers/EthersAppContext.tsx#L97) +[src/context/ethers/EthersAppContext.tsx:97](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/context/ethers/EthersAppContext.tsx#L97) ___ @@ -370,7 +370,7 @@ ___ #### Defined in -[src/context/ethers/connectors/EthersModalConnector.ts:45](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/context/ethers/connectors/EthersModalConnector.ts#L45) +[src/context/ethers/connectors/EthersModalConnector.ts:45](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/context/ethers/connectors/EthersModalConnector.ts#L45) ## EthersContext Variables @@ -387,7 +387,7 @@ A context that works with [useBlockNumberContext](EthersContext.md#useblocknumbe #### Defined in -[src/context/ethers/BlockNumberContext.tsx:86](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/context/ethers/BlockNumberContext.tsx#L86) +[src/context/ethers/BlockNumberContext.tsx:86](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/context/ethers/BlockNumberContext.tsx#L86) ___ @@ -405,7 +405,7 @@ This is a wrapper around Web3ReactProvider that provides additional functionalit #### Defined in -[src/context/ethers/EthersAppContext.tsx:144](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/context/ethers/EthersAppContext.tsx#L144) +[src/context/ethers/EthersAppContext.tsx:144](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/context/ethers/EthersAppContext.tsx#L144) ___ @@ -417,4 +417,4 @@ ___ #### Defined in -[src/context/ethers/queryClient.ts:3](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/context/ethers/queryClient.ts#L3) +[src/context/ethers/queryClient.ts:3](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/context/ethers/queryClient.ts#L3) diff --git a/docs/api-typedocs/modules/Helpers.md b/docs/api-typedocs/modules/Helpers.md index 9f79d79b..c2119a0f 100644 --- a/docs/api-typedocs/modules/Helpers.md +++ b/docs/api-typedocs/modules/Helpers.md @@ -43,4 +43,4 @@ const ExampleUI = lazier(() => import('./exampleui/ExampleUI'), 'ExampleUI'); #### Defined in -[src/helpers/lazier.ts:18](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/helpers/lazier.ts#L18) +[src/helpers/lazier.ts:18](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/helpers/lazier.ts#L18) diff --git a/docs/api-typedocs/modules/Hooks.md b/docs/api-typedocs/modules/Hooks.md index cae37efd..0b45735c 100644 --- a/docs/api-typedocs/modules/Hooks.md +++ b/docs/api-typedocs/modules/Hooks.md @@ -51,7 +51,7 @@ Commonly used ethereum hooks to turbocharge your development! Works with [useEt #### Summary Get the Exchange price of ETH/USD (extrapolated from WETH/DAI) from uniswap -#### Notes +##### Notes - uses useOnRepetition, does not use context #### Parameters @@ -70,7 +70,7 @@ price in USD #### Defined in -[src/hooks/dapps/useDexEthPrice.ts:27](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/hooks/dapps/useDexEthPrice.ts#L27) +[src/hooks/dapps/useDexEthPrice.ts:27](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/hooks/dapps/useDexEthPrice.ts#L27) ___ @@ -100,7 +100,7 @@ Gets a tokenlist from uniswap ipfs tokenlist #### Defined in -[src/hooks/dapps/useDexTokenList.ts:27](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/hooks/dapps/useDexTokenList.ts#L27) +[src/hooks/dapps/useDexTokenList.ts:27](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/hooks/dapps/useDexTokenList.ts#L27) ___ @@ -124,7 +124,7 @@ Gets the address from an ENS name #### Defined in -[src/hooks/dapps/useResolveEnsAddress.ts:19](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/hooks/dapps/useResolveEnsAddress.ts#L19) +[src/hooks/dapps/useResolveEnsAddress.ts:19](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/hooks/dapps/useResolveEnsAddress.ts#L19) ___ @@ -148,7 +148,7 @@ Gets ENS name for given address #### Defined in -[src/hooks/dapps/useResolveEnsName.ts:45](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/hooks/dapps/useResolveEnsName.ts#L45) +[src/hooks/dapps/useResolveEnsName.ts:45](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/hooks/dapps/useResolveEnsName.ts#L45) ___ @@ -160,7 +160,7 @@ ___ Get the balance of an ERC20 token in an address - uses the ethers.Contract object's provider to access the network -#### Notes +##### Notes - uses useOnRepetition #### Type parameters @@ -183,7 +183,7 @@ Get the balance of an ERC20 token in an address #### Defined in -[src/hooks/erc/useTokenBalance.ts:33](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/hooks/erc/useTokenBalance.ts#L33) +[src/hooks/erc/useTokenBalance.ts:33](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/hooks/erc/useTokenBalance.ts#L33) ___ @@ -207,7 +207,7 @@ Are the signers equal and valid #### Defined in -[src/hooks/useAreSignerEqual.ts:17](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/hooks/useAreSignerEqual.ts#L17) +[src/hooks/useAreSignerEqual.ts:17](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/hooks/useAreSignerEqual.ts#L17) ___ @@ -218,7 +218,7 @@ ___ #### Summary Gets your balance in ETH for the given address. -#### Notes +##### Notes - updates triggered by [BlockNumberContext](EthersContext.md#blocknumbercontext) - uses the current provider {@link provider} from [useEthersContext](EthersContext.md#useetherscontext) @@ -245,7 +245,7 @@ current balance #### Defined in -[src/hooks/useBalance.ts:34](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/hooks/useBalance.ts#L34) +[src/hooks/useBalance.ts:34](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/hooks/useBalance.ts#L34) ___ @@ -256,7 +256,7 @@ ___ #### Summary Get the current block number of the network. ✋🏽 @deprecated -#### Notes +##### Notes - ✋🏽 For app wide block number access use [useBlockNumberContext](EthersContext.md#useblocknumbercontext) instead. See [BlockNumberContext](EthersContext.md#blocknumbercontext) for more details, you get this as part of [EthersAppContext](EthersContext.md#ethersappcontext) - uses the current provided block number @@ -275,7 +275,7 @@ block number #### Defined in -[src/hooks/useBlockNumber.ts:19](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/hooks/useBlockNumber.ts#L19) +[src/hooks/useBlockNumber.ts:19](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/hooks/useBlockNumber.ts#L19) ___ @@ -301,7 +301,7 @@ IBurnerSigner #### Defined in -[src/hooks/useBurnerSigner.ts:87](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/hooks/useBurnerSigner.ts#L87) +[src/hooks/useBurnerSigner.ts:87](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/hooks/useBurnerSigner.ts#L87) ___ @@ -312,7 +312,7 @@ ___ #### Summary Checks whether a contract exists on the blockchain -#### Notes +##### Notes - uses the ethers.Contract object's provider to access the network - checks the contract address to see if the contract is deployed @@ -329,7 +329,7 @@ Checks whether a contract exists on the blockchain #### Defined in -[src/hooks/useContractExistsAtAddress.ts:25](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/hooks/useContractExistsAtAddress.ts#L25) +[src/hooks/useContractExistsAtAddress.ts:25](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/hooks/useContractExistsAtAddress.ts#L25) ___ @@ -341,7 +341,7 @@ ___ Loads your contracts and returns them. ✋🏽 @deprecated Gives options to read values from contracts or write transactions into them. -#### Notes +##### Notes - ✋🏽 For easy app wide contract access use {@link AppContractContex} created by [contractsContextFactory](EthersContext.md#contractscontextfactory). See [contractsContextFactory](EthersContext.md#contractscontextfactory) for more details. A optional providerOrSigner is needed to initalize the contract class @@ -367,7 +367,7 @@ Record of contractName:Contracts #### Defined in -[src/hooks/useContractLoader.ts:105](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/hooks/useContractLoader.ts#L105) +[src/hooks/useContractLoader.ts:105](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/hooks/useContractLoader.ts#L105) ___ @@ -378,7 +378,7 @@ ___ #### Summary Enables you to call a contract function with arguments and receive the output. You can use this to easily track of contract outputs in react states -#### Notes +##### Notes - uses the ethers.Contract object's provider to access the network - formatter is a function that can change the format of the output @@ -406,7 +406,7 @@ Enables you to call a contract function with arguments and receive the output. #### Defined in -[src/hooks/useContractReader.ts:109](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/hooks/useContractReader.ts#L109) +[src/hooks/useContractReader.ts:109](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/hooks/useContractReader.ts#L109) ___ @@ -430,7 +430,7 @@ Gets the user {@link TEthersUser} for a signer or wallet #### Defined in -[src/hooks/useEthersAdaptorFromProviderOrSigners.ts:30](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/hooks/useEthersAdaptorFromProviderOrSigners.ts#L30) +[src/hooks/useEthersAdaptorFromProviderOrSigners.ts:30](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/hooks/useEthersAdaptorFromProviderOrSigners.ts#L30) ___ @@ -441,7 +441,7 @@ ___ #### Summary Tracks the events of associated with a contract -#### Notes +##### Notes - updates triggered through ethers event listener - uses the current provider {@link ethersProvider} from [useEthersContext](EthersContext.md#useetherscontext) @@ -467,7 +467,7 @@ Tracks the events of associated with a contract #### Defined in -[src/hooks/useEventListener.ts:26](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/hooks/useEventListener.ts#L26) +[src/hooks/useEventListener.ts:26](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/hooks/useEventListener.ts#L26) ___ @@ -481,7 +481,7 @@ Gets the gas price for the current network as gwei - uses ethers.estimateGas other networks - can use currentNetworkInfo {@link TNetworkInfo.gasPrice} gasPrice as fallback -#### Notes +##### Notes - if the gas price is unknown it returns undefined - updates triggered by [BlockNumberContext](EthersContext.md#blocknumbercontext) - uses the current provider {@link ethersProvider} from [useEthersContext](EthersContext.md#useetherscontext) @@ -504,7 +504,7 @@ gas as gwei #### Defined in -[src/hooks/useGasPrice.ts:48](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/hooks/useGasPrice.ts#L48) +[src/hooks/useGasPrice.ts:48](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/hooks/useGasPrice.ts#L48) ___ @@ -515,7 +515,7 @@ ___ #### Summary Get the current nonce for the address provided -#### Notes +##### Notes - updates triggered by [BlockNumberContext](EthersContext.md#blocknumbercontext) - uses the current provider {@link ethersProvider} from [useEthersContext](EthersContext.md#useetherscontext) @@ -533,7 +533,7 @@ Get the current nonce for the address provided #### Defined in -[src/hooks/useNonce.ts:33](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/hooks/useNonce.ts#L33) +[src/hooks/useNonce.ts:33](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/hooks/useNonce.ts#L33) ___ @@ -556,7 +556,7 @@ Get the address from the signer #### Defined in -[src/hooks/useSignerAddress.ts:19](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/hooks/useSignerAddress.ts#L19) +[src/hooks/useSignerAddress.ts:19](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/hooks/useSignerAddress.ts#L19) ___ @@ -580,7 +580,7 @@ Get the address from the signer #### Defined in -[src/hooks/useSignerChainId.ts:20](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/hooks/useSignerChainId.ts#L20) +[src/hooks/useSignerChainId.ts:20](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/hooks/useSignerChainId.ts#L20) ___ @@ -591,7 +591,7 @@ ___ #### Summary Get the current timestamp from the latest block -#### Notes +##### Notes - updates triggered by [BlockNumberContext](EthersContext.md#blocknumbercontext) - uses the current provider {@link ethersProvider} from [useEthersContext](EthersContext.md#useetherscontext) @@ -608,7 +608,7 @@ Get the current timestamp from the latest block #### Defined in -[src/hooks/useTimestamp.ts:30](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/hooks/useTimestamp.ts#L30) +[src/hooks/useTimestamp.ts:30](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/hooks/useTimestamp.ts#L30) ___ @@ -631,7 +631,7 @@ ___ #### Defined in -[src/hooks/useContractLoader.ts:59](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/hooks/useContractLoader.ts#L59) +[src/hooks/useContractLoader.ts:59](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/hooks/useContractLoader.ts#L59) ___ @@ -642,7 +642,7 @@ ___ #### Summary Enables you to call a contract function with arguments and receive the output. You can use this to easily track of contract outputs in react states -#### Notes +##### Notes - uses the ethers.Contract object's provider to access the network - formatter is a function that can change the format of the output @@ -669,7 +669,7 @@ Enables you to call a contract function with arguments and receive the output. #### Defined in -[src/hooks/useContractReader.ts:27](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/hooks/useContractReader.ts#L27) +[src/hooks/useContractReader.ts:27](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/hooks/useContractReader.ts#L27) ## Hooks Type aliases @@ -680,7 +680,7 @@ Enables you to call a contract function with arguments and receive the output. #### Summary Return type of useBurnerSigner: -#### Notes +##### Notes - provides signer - methods of interacting with burner signer - methods to save and loadd signer from local storage @@ -698,7 +698,7 @@ Return type of useBurnerSigner: #### Defined in -[src/hooks/useBurnerSigner.ts:56](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/hooks/useBurnerSigner.ts#L56) +[src/hooks/useBurnerSigner.ts:56](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/hooks/useBurnerSigner.ts#L56) ___ @@ -714,7 +714,7 @@ Preset speeds for Eth Gas Station API #### Defined in -[src/hooks/useGasPrice.ts:28](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/hooks/useGasPrice.ts#L28) +[src/hooks/useGasPrice.ts:28](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/hooks/useGasPrice.ts#L28) ___ @@ -738,4 +738,4 @@ Configuration for useContractLoader #### Defined in -[src/hooks/useContractLoader.ts:39](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/hooks/useContractLoader.ts#L39) +[src/hooks/useContractLoader.ts:39](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/hooks/useContractLoader.ts#L39) diff --git a/docs/api-typedocs/modules/Models.md b/docs/api-typedocs/modules/Models.md index 2d1fbc0b..77a420d1 100644 --- a/docs/api-typedocs/modules/Models.md +++ b/docs/api-typedocs/modules/Models.md @@ -67,7 +67,7 @@ Types and constants to make it easier to interact with ethers. #### Defined in -[src/models/constants/common.ts:1](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/models/constants/common.ts#L1) +[src/models/constants/common.ts:1](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/models/constants/common.ts#L1) ___ @@ -86,7 +86,7 @@ ___ #### Defined in -[src/models/constants/keyNamespace.ts:1](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/models/constants/keyNamespace.ts#L1) +[src/models/constants/keyNamespace.ts:1](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/models/constants/keyNamespace.ts#L1) ___ @@ -99,7 +99,7 @@ An constant for block number interval of 10 blocks #### Defined in -[src/models/hookOptions.ts:9](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/models/hookOptions.ts#L9) +[src/models/hookOptions.ts:9](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/models/hookOptions.ts#L9) ___ @@ -112,7 +112,7 @@ An constant for block number interval of 50 blocks #### Defined in -[src/models/hookOptions.ts:15](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/models/hookOptions.ts#L15) +[src/models/hookOptions.ts:15](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/models/hookOptions.ts#L15) ___ @@ -125,7 +125,7 @@ An constant for block number interval of 250 blocks #### Defined in -[src/models/hookOptions.ts:21](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/models/hookOptions.ts#L21) +[src/models/hookOptions.ts:21](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/models/hookOptions.ts#L21) ## EthersContext Type aliases @@ -140,7 +140,7 @@ An constant for block number interval of 250 blocks #### Summary A callback type that returns a EthersModalConnector -#### Notes +##### Notes - can be used by components that need to give a connector to [IEthersContext.openModal](../interfaces/Models.IEthersContext.md#openmodal) - id is the identifier of the provider: [See docs](https://github.com/Web3Modal/web3modal#connect-to-specific-provider) @@ -156,7 +156,7 @@ A callback type that returns a EthersModalConnector #### Defined in -[src/models/ethersAppContextTypes.ts:17](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/models/ethersAppContextTypes.ts#L17) +[src/models/ethersAppContextTypes.ts:17](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/models/ethersAppContextTypes.ts#L17) ___ @@ -177,7 +177,7 @@ Describes the structure of hardhat_contracts.json #### Defined in -[src/models/contractTypes.ts:30](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/models/contractTypes.ts#L30) +[src/models/contractTypes.ts:30](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/models/contractTypes.ts#L30) ___ @@ -197,7 +197,7 @@ A type for external contracts #### Defined in -[src/models/contractTypes.ts:54](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/models/contractTypes.ts#L54) +[src/models/contractTypes.ts:54](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/models/contractTypes.ts#L54) ___ @@ -221,7 +221,7 @@ Contract function information: #### Defined in -[src/models/contractTypes.ts:69](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/models/contractTypes.ts#L69) +[src/models/contractTypes.ts:69](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/models/contractTypes.ts#L69) ___ @@ -247,7 +247,7 @@ A type that describes the basics of a network for applications. e.g. mainnet, ro #### Defined in -[src/models/networkTypes.ts:7](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/models/networkTypes.ts#L7) +[src/models/networkTypes.ts:7](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/models/networkTypes.ts#L7) ___ @@ -258,12 +258,12 @@ ___ #### Summary A union of various ethers providers for ease of use and maximum flexiblity -#### Notes +##### Notes Used by eth-hooks, eth-components and scaffold-eth-typescript #### Defined in -[src/models/providerTypes.ts:19](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/models/providerTypes.ts#L19) +[src/models/providerTypes.ts:19](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/models/providerTypes.ts#L19) ___ @@ -276,7 +276,7 @@ A union of various providers and signers in ethers to give maximum flexibility #### Defined in -[src/models/providerTypes.ts:27](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/models/providerTypes.ts#L27) +[src/models/providerTypes.ts:27](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/models/providerTypes.ts#L27) ___ @@ -289,7 +289,7 @@ A union of various providers in ethers to give maximum flexibility #### Defined in -[src/models/providerTypes.ts:42](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/models/providerTypes.ts#L42) +[src/models/providerTypes.ts:42](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/models/providerTypes.ts#L42) ___ @@ -302,7 +302,7 @@ A union of abstract, non initalizable providers, used by some functions #### Defined in -[src/models/providerTypes.ts:50](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/models/providerTypes.ts#L50) +[src/models/providerTypes.ts:50](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/models/providerTypes.ts#L50) ___ @@ -322,7 +322,7 @@ An generic extension of EventFilter that is used by TypedEvent. It allows for t #### Defined in -[src/models/providerTypes.ts:58](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/models/providerTypes.ts#L58) +[src/models/providerTypes.ts:58](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/models/providerTypes.ts#L58) ___ @@ -341,7 +341,7 @@ An generic extension of Event. It types the the arguments and return values of #### Defined in -[src/models/providerTypes.ts:69](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/models/providerTypes.ts#L69) +[src/models/providerTypes.ts:69](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/models/providerTypes.ts#L69) ___ @@ -360,7 +360,7 @@ Similar to [partial](https://www.typescriptlang.org/docs/handbook/utility-types. #### Defined in -[src/models/utilityTypes.ts:7](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/models/utilityTypes.ts#L7) +[src/models/utilityTypes.ts:7](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/models/utilityTypes.ts#L7) ___ @@ -387,7 +387,7 @@ ___ #### Defined in -[src/models/contractContextTypes.ts:4](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/models/contractContextTypes.ts#L4) +[src/models/contractContextTypes.ts:4](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/models/contractContextTypes.ts#L4) ___ @@ -405,7 +405,7 @@ ___ #### Defined in -[src/models/contractContextTypes.ts:13](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/models/contractContextTypes.ts#L13) +[src/models/contractContextTypes.ts:13](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/models/contractContextTypes.ts#L13) ___ @@ -421,7 +421,7 @@ ___ #### Defined in -[src/models/contractContextTypes.ts:24](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/models/contractContextTypes.ts#L24) +[src/models/contractContextTypes.ts:24](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/models/contractContextTypes.ts#L24) ___ @@ -438,7 +438,7 @@ ___ #### Defined in -[src/models/contractContextTypes.ts:28](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/models/contractContextTypes.ts#L28) +[src/models/contractContextTypes.ts:28](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/models/contractContextTypes.ts#L28) ___ @@ -454,7 +454,7 @@ ___ #### Defined in -[src/models/contractContextTypes.ts:37](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/models/contractContextTypes.ts#L37) +[src/models/contractContextTypes.ts:37](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/models/contractContextTypes.ts#L37) ___ @@ -470,7 +470,7 @@ ___ #### Defined in -[src/models/contractContextTypes.ts:42](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/models/contractContextTypes.ts#L42) +[src/models/contractContextTypes.ts:42](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/models/contractContextTypes.ts#L42) ___ @@ -494,7 +494,7 @@ ___ #### Defined in -[src/models/contractContextTypes.ts:50](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/models/contractContextTypes.ts#L50) +[src/models/contractContextTypes.ts:50](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/models/contractContextTypes.ts#L50) ___ @@ -514,7 +514,7 @@ Describes the sctructure of each contract in hardhat_contracts.json #### Defined in -[src/models/contractTypes.ts:5](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/models/contractTypes.ts#L5) +[src/models/contractTypes.ts:5](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/models/contractTypes.ts#L5) ___ @@ -533,7 +533,7 @@ Contracts by contract name #### Defined in -[src/models/contractTypes.ts:16](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/models/contractTypes.ts#L16) +[src/models/contractTypes.ts:16](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/models/contractTypes.ts#L16) ___ @@ -545,7 +545,7 @@ ___ Options for hooks that describe the behviour of updates. By default, depending on the hook, it will update every block. -#### Notes +##### Notes The following options are available: - interval: interval in blocknumber to update in (default 1) see {@link TUpdateOptions.blockNumberInterval} - polling: in ms, should be over 10000ms. This is set by {@link TUpdateOptions.query.refetchInterval} @@ -563,7 +563,7 @@ The following options are available: #### Defined in -[src/models/hookOptions.ts:33](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/models/hookOptions.ts#L33) +[src/models/hookOptions.ts:33](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/models/hookOptions.ts#L33) ___ @@ -576,7 +576,7 @@ Ethers Provider options. By default, the context provider is used by the hook. - pass in an [TEthersAdaptor](Models.md#tethersadaptor) to override the provider - give the alternateContextKey for a secondary context provider. -#### Notes +##### Notes Adaptor - To create a adaptor from a provider/signer see {@link useGetEthersAdaptorFromSignerOrProvider} - You need to set adaptorEnabled to true @@ -594,7 +594,7 @@ Alternate Context Key #### Defined in -[src/models/hookOptions.ts:76](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/models/hookOptions.ts#L76) +[src/models/hookOptions.ts:76](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/models/hookOptions.ts#L76) ___ @@ -619,7 +619,7 @@ Essentially a object that allows interaction with the network: #### Defined in -[src/models/ethersAppContextTypes.ts:49](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/models/ethersAppContextTypes.ts#L49) +[src/models/ethersAppContextTypes.ts:49](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/models/ethersAppContextTypes.ts#L49) ## Functions @@ -635,7 +635,7 @@ An helper to create the default override settings for hooks #### Defined in -[src/models/hookOptions.ts:96](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/models/hookOptions.ts#L96) +[src/models/hookOptions.ts:96](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/models/hookOptions.ts#L96) ___ @@ -651,4 +651,4 @@ A helper to create default update options for hooks #### Defined in -[src/models/hookOptions.ts:108](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/models/hookOptions.ts#L108) +[src/models/hookOptions.ts:108](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/models/hookOptions.ts#L108) diff --git a/docs/api-typedocs/modules/TestUtils.md b/docs/api-typedocs/modules/TestUtils.md index 37ee494e..ddab22a0 100644 --- a/docs/api-typedocs/modules/TestUtils.md +++ b/docs/api-typedocs/modules/TestUtils.md @@ -44,7 +44,7 @@ Utilities to write tests with ethers, waffle and react hooks #### Defined in -[src/helpers/test-utils/constants/testConstants.ts:3](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/helpers/test-utils/constants/testConstants.ts#L3) +[src/helpers/test-utils/constants/testConstants.ts:3](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/helpers/test-utils/constants/testConstants.ts#L3) ___ @@ -54,7 +54,7 @@ ___ #### Defined in -[src/helpers/test-utils/constants/testConstants.ts:5](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/helpers/test-utils/constants/testConstants.ts#L5) +[src/helpers/test-utils/constants/testConstants.ts:5](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/helpers/test-utils/constants/testConstants.ts#L5) ___ @@ -64,7 +64,7 @@ ___ #### Defined in -[src/helpers/test-utils/constants/testConstants.ts:7](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/helpers/test-utils/constants/testConstants.ts#L7) +[src/helpers/test-utils/constants/testConstants.ts:7](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/helpers/test-utils/constants/testConstants.ts#L7) ___ @@ -80,7 +80,7 @@ This is a wrapper for tests #### Defined in -[src/helpers/test-utils/wrapper/TestAppWrapper.tsx:37](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/helpers/test-utils/wrapper/TestAppWrapper.tsx#L37) +[src/helpers/test-utils/wrapper/TestAppWrapper.tsx:37](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/helpers/test-utils/wrapper/TestAppWrapper.tsx#L37) ## Functions @@ -100,7 +100,7 @@ This is a wrapper for tests #### Defined in -[src/helpers/test-utils/eth/hardhatActions.ts:3](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/helpers/test-utils/eth/hardhatActions.ts#L3) +[src/helpers/test-utils/eth/hardhatActions.ts:3](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/helpers/test-utils/eth/hardhatActions.ts#L3) ___ @@ -120,7 +120,7 @@ ___ #### Defined in -[src/helpers/test-utils/functions/conversions.ts:3](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/helpers/test-utils/functions/conversions.ts#L3) +[src/helpers/test-utils/functions/conversions.ts:3](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/helpers/test-utils/functions/conversions.ts#L3) ___ @@ -140,7 +140,7 @@ ___ #### Defined in -[src/helpers/test-utils/functions/conversions.ts:7](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/helpers/test-utils/functions/conversions.ts#L7) +[src/helpers/test-utils/functions/conversions.ts:7](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/helpers/test-utils/functions/conversions.ts#L7) ___ @@ -160,7 +160,7 @@ ___ #### Defined in -[src/helpers/test-utils/functions/expect.ts:4](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/helpers/test-utils/functions/expect.ts#L4) +[src/helpers/test-utils/functions/expect.ts:4](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/helpers/test-utils/functions/expect.ts#L4) ___ @@ -174,7 +174,7 @@ ___ #### Defined in -[src/helpers/test-utils/wrapper/getMockProvider.ts:6](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/helpers/test-utils/wrapper/getMockProvider.ts#L6) +[src/helpers/test-utils/wrapper/getMockProvider.ts:6](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/helpers/test-utils/wrapper/getMockProvider.ts#L6) ___ @@ -188,7 +188,7 @@ ___ #### Defined in -[src/helpers/test-utils/wrapper/hardhatTestHelpers.ts:4](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/helpers/test-utils/wrapper/hardhatTestHelpers.ts#L4) +[src/helpers/test-utils/wrapper/hardhatTestHelpers.ts:4](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/helpers/test-utils/wrapper/hardhatTestHelpers.ts#L4) ___ @@ -202,7 +202,7 @@ ___ #### Defined in -[src/helpers/test-utils/wrapper/hardhatTestHelpers.ts:12](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/helpers/test-utils/wrapper/hardhatTestHelpers.ts#L12) +[src/helpers/test-utils/wrapper/hardhatTestHelpers.ts:12](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/helpers/test-utils/wrapper/hardhatTestHelpers.ts#L12) ___ @@ -234,7 +234,7 @@ Created a test hook with a Web3Wrapper #### Defined in -[src/helpers/test-utils/wrapper/testWrapper.tsx:28](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/helpers/test-utils/wrapper/testWrapper.tsx#L28) +[src/helpers/test-utils/wrapper/testWrapper.tsx:28](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/helpers/test-utils/wrapper/testWrapper.tsx#L28) ___ @@ -254,7 +254,7 @@ ___ #### Defined in -[src/helpers/test-utils/wrapper/wrapperHelpers.ts:6](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/helpers/test-utils/wrapper/wrapperHelpers.ts#L6) +[src/helpers/test-utils/wrapper/wrapperHelpers.ts:6](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/helpers/test-utils/wrapper/wrapperHelpers.ts#L6) ___ @@ -274,7 +274,7 @@ ___ #### Defined in -[src/helpers/test-utils/wrapper/wrapperHelpers.ts:15](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/helpers/test-utils/wrapper/wrapperHelpers.ts#L15) +[src/helpers/test-utils/wrapper/wrapperHelpers.ts:15](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/helpers/test-utils/wrapper/wrapperHelpers.ts#L15) ___ @@ -295,7 +295,7 @@ ___ #### Defined in -[src/helpers/test-utils/wrapper/wrapperHelpers.ts:26](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/helpers/test-utils/wrapper/wrapperHelpers.ts#L26) +[src/helpers/test-utils/wrapper/wrapperHelpers.ts:26](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/helpers/test-utils/wrapper/wrapperHelpers.ts#L26) ___ @@ -316,7 +316,7 @@ ___ #### Defined in -[src/helpers/test-utils/wrapper/wrapperHelpers.ts:36](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/helpers/test-utils/wrapper/wrapperHelpers.ts#L36) +[src/helpers/test-utils/wrapper/wrapperHelpers.ts:36](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/helpers/test-utils/wrapper/wrapperHelpers.ts#L36) ## Type aliases @@ -332,4 +332,4 @@ ___ #### Defined in -[src/helpers/test-utils/wrapper/testWrapper.tsx:14](https://github.com/scaffold-eth/eth-hooks/blob/7a28cdc/src/helpers/test-utils/wrapper/testWrapper.tsx#L14) +[src/helpers/test-utils/wrapper/testWrapper.tsx:14](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/helpers/test-utils/wrapper/testWrapper.tsx#L14) diff --git a/package.json b/package.json index 0a26cc7f..6904b7ee 100644 --- a/package.json +++ b/package.json @@ -144,6 +144,7 @@ "typechain": "^7.0.0", "typedoc": "^0.22.10", "typedoc-plugin-markdown": "^3.11.11", + "typedoc-plugin-mermaid": "^1.6.0", "typescript": "^4.5.4", "typescript-transform-paths": "^3.3.1" }, diff --git a/src/context/ethers/BlockNumberContext.tsx b/src/context/ethers/BlockNumberContext.tsx index 2d17221f..6aa96c56 100644 --- a/src/context/ethers/BlockNumberContext.tsx +++ b/src/context/ethers/BlockNumberContext.tsx @@ -48,12 +48,12 @@ const reducer = (state: State = {}, payload: Payload): State => { * A hook that gets you the current blocknumber via react context * - can be shared by your whole app. * - * #### Use + * ##### Use * Make sure to wrap your main app with the {@link EthersAppContext}. * - See [scaffold-eth-typescript example](https://github.com/scaffold-eth/scaffold-eth-typescript/blob/0225179a2a8bb7b3a255d6eff4802b47d72809dd/packages/vite-app-ts/src/components/routes/App.tsx#L38) * * - * #### Notes + * ##### Notes * - this extensively used by eth-hooks to trigger hooks when a new block arrives * - uses the current provider {@link ethersProvider} from {@link useEthersContext} * diff --git a/src/context/ethers/EthersAppContext.tsx b/src/context/ethers/EthersAppContext.tsx index fa29cb59..4d13193f 100644 --- a/src/context/ethers/EthersAppContext.tsx +++ b/src/context/ethers/EthersAppContext.tsx @@ -19,14 +19,14 @@ import { IEthersContext } from '~~/models/ethersAppContextTypes'; * This Hook provides you with access to the current Ethers Provider Context. * This provider would be the one selected by using {@link EthersModalConnector} and Web3Modal * - * #### Features + * ##### Features * Gives you access to consistent interface to get the current provider information {@link EthersModalConnector} * - ethers compatable provider {@link TEthersProvider} * - a callback to change the current account (signer) * - the current account, chainId and signer * - callbacks to open the web3Modal, logout or change theme * - * #### Notes + * ##### Notes * - currently providerKey isnt being used * * @category EthersContext diff --git a/src/context/ethers/connectors/EthersModalConnector.ts b/src/context/ethers/connectors/EthersModalConnector.ts index 110a8be9..21f7f220 100644 --- a/src/context/ethers/connectors/EthersModalConnector.ts +++ b/src/context/ethers/connectors/EthersModalConnector.ts @@ -49,11 +49,11 @@ export type TEthersModalConnector = ICommonModalConnector & AbstractConnector; * This is a connector for [web3-react](https://github.com/NoahZinsmeister/web3-react) that allows it to interface with [web3Modal](https://github.com/Web3Modal/web3modal). * The provider selected by user via web3modal is interfaced to the web3-react context. * - * #### Features + * ##### Features * - This connector used with {@link useEthersContext} allows the app and all the hooks to effortlessly access the current network, provider, signer, address information {@link IEthersContext} * - The connector centralizes and takes care of management of the web3 interaction and provides a consistent exprience for your app. * - * #### Notes + * ##### Notes * - inherits from web3-react class AbstractConnector * * @category EthersContext @@ -161,13 +161,13 @@ export class EthersModalConnector extends AbstractConnector implements ICommonMo * #### Summary * Inherits from AbstractConnector. This activates web3Modal and opens the modal. * - * #### Notes + * ##### Notes * Once the user selects a provider * - this will activate the provider and attach the appropriate event listeners. * - get the account and signer * - gets the ethers compatable provider * - * #### Errors + * ##### Errors * - {@link UserClosedModalError} * - {@link CouldNotActivateError} * @returns diff --git a/src/context/ethers/connectors/StaticJsonRpcProviderConnector.ts b/src/context/ethers/connectors/StaticJsonRpcProviderConnector.ts index f572be05..bb68ea9f 100644 --- a/src/context/ethers/connectors/StaticJsonRpcProviderConnector.ts +++ b/src/context/ethers/connectors/StaticJsonRpcProviderConnector.ts @@ -18,7 +18,7 @@ export interface IStaticJsonRpcProviderConnectorOptions extends IAbstractConnect * A connector that can be used by apps to connect to a StaticJsonRpcProvider * - For example you can use this to connect to a localhost provider * - * #### Notes + * ##### Notes * See scaffold-eth-typescript for an example that uses it to connect to a localhost burner wallet. * - [scaffold-eth-typescript example](https://github.com/scaffold-eth/scaffold-eth-typescript/blob/0225179a2a8bb7b3a255d6eff4802b47d72809dd/packages/vite-app-ts/src/config/web3ModalConfig.ts#L86) * diff --git a/src/hooks/dapps/useDexEthPrice.ts b/src/hooks/dapps/useDexEthPrice.ts index f22a23b1..0d64aa62 100644 --- a/src/hooks/dapps/useDexEthPrice.ts +++ b/src/hooks/dapps/useDexEthPrice.ts @@ -14,7 +14,7 @@ const queryKey: TRequiredKeys = { namespace: keyNamespace.signer, key: 'useDexEt * #### Summary * Get the Exchange price of ETH/USD (extrapolated from WETH/DAI) from uniswap * - * #### Notes + * ##### Notes * - uses useOnRepetition, does not use context * * @category Hooks diff --git a/src/hooks/erc/useTokenBalance.ts b/src/hooks/erc/useTokenBalance.ts index 89891066..17974571 100644 --- a/src/hooks/erc/useTokenBalance.ts +++ b/src/hooks/erc/useTokenBalance.ts @@ -20,7 +20,7 @@ type ERC20 = { * Get the balance of an ERC20 token in an address * - uses the ethers.Contract object's provider to access the network * - * #### Notes + * ##### Notes * - uses useOnRepetition * * @category Hooks diff --git a/src/hooks/useBalance.ts b/src/hooks/useBalance.ts index 409e355a..8337cb25 100644 --- a/src/hooks/useBalance.ts +++ b/src/hooks/useBalance.ts @@ -21,7 +21,7 @@ type TUseBalanceResult> = GAddress exten * #### Summary * Gets your balance in ETH for the given address. * - * #### Notes + * ##### Notes * - updates triggered by {@link BlockNumberContext} * - uses the current provider {@link provider} from {@link useEthersContext} * diff --git a/src/hooks/useBlockNumber.ts b/src/hooks/useBlockNumber.ts index c19d75c6..0fdc133a 100644 --- a/src/hooks/useBlockNumber.ts +++ b/src/hooks/useBlockNumber.ts @@ -1,5 +1,5 @@ import { useCallback, useEffect, useState } from 'react'; -import { useCounter, useIsMounted } from 'usehooks-ts'; +import { useIsMounted } from 'usehooks-ts'; import { TEthersProvider } from '~~/models'; @@ -7,7 +7,7 @@ import { TEthersProvider } from '~~/models'; * #### Summary * Get the current block number of the network. ✋🏽 @deprecated * - * #### Notes + * ##### Notes * - ✋🏽 For app wide block number access use {@link useBlockNumberContext} instead. See {@link BlockNumberContext} for more details, you get this as part of {@link EthersAppContext} * - uses the current provided block number * diff --git a/src/hooks/useBurnerSigner.ts b/src/hooks/useBurnerSigner.ts index a1373c58..097a5bb7 100644 --- a/src/hooks/useBurnerSigner.ts +++ b/src/hooks/useBurnerSigner.ts @@ -46,7 +46,7 @@ const loadBurnerKeyFromStorage = (): string | null => { * #### Summary * Return type of useBurnerSigner: * - * #### Notes + * ##### Notes * - provides signer * - methods of interacting with burner signer * - methods to save and loadd signer from local storage diff --git a/src/hooks/useContractExistsAtAddress.ts b/src/hooks/useContractExistsAtAddress.ts index 8599fb87..598df7f0 100644 --- a/src/hooks/useContractExistsAtAddress.ts +++ b/src/hooks/useContractExistsAtAddress.ts @@ -13,7 +13,7 @@ const queryKey: TRequiredKeys = { namespace: keyNamespace.contracts, key: 'useCo * #### Summary * Checks whether a contract exists on the blockchain * - * #### Notes + * ##### Notes * - uses the ethers.Contract object's provider to access the network * - checks the contract address to see if the contract is deployed * diff --git a/src/hooks/useContractLoader.ts b/src/hooks/useContractLoader.ts index 898262a0..e8eb25ab 100644 --- a/src/hooks/useContractLoader.ts +++ b/src/hooks/useContractLoader.ts @@ -84,7 +84,7 @@ export const parseContractsInJson = ( * Loads your contracts and returns them. ✋🏽 @deprecated * Gives options to read values from contracts or write transactions into them. * - * #### Notes + * ##### Notes * - ✋🏽 For easy app wide contract access use {@link AppContractContex} created by {@link contractsContextFactory}. See {@link contractsContextFactory} for more details. * * A optional providerOrSigner is needed to initalize the contract class diff --git a/src/hooks/useContractReader.ts b/src/hooks/useContractReader.ts index 79cc8839..55c41358 100644 --- a/src/hooks/useContractReader.ts +++ b/src/hooks/useContractReader.ts @@ -15,7 +15,7 @@ const queryKey = { namespace: keyNamespace.contracts, key: 'useContractReader' } * #### Summary * Enables you to call a contract function with arguments and receive the output. You can use this to easily track of contract outputs in react states * - * #### Notes + * ##### Notes * - uses the ethers.Contract object's provider to access the network * - formatter is a function that can change the format of the output * @param contract @@ -93,7 +93,7 @@ export const useContractReader = < * #### Summary * Enables you to call a contract function with arguments and receive the output. You can use this to easily track of contract outputs in react states * - * #### Notes + * ##### Notes * - uses the ethers.Contract object's provider to access the network * - formatter is a function that can change the format of the output * diff --git a/src/hooks/useEventListener.ts b/src/hooks/useEventListener.ts index 172af003..ce759746 100644 --- a/src/hooks/useEventListener.ts +++ b/src/hooks/useEventListener.ts @@ -12,7 +12,7 @@ const queryKey: TRequiredKeys = { namespace: keyNamespace.contracts, key: 'useEv * #### Summary * Tracks the events of associated with a contract * - * #### Notes + * ##### Notes * - updates triggered through ethers event listener * - uses the current provider {@link ethersProvider} from {@link useEthersContext} * diff --git a/src/hooks/useGasPrice.ts b/src/hooks/useGasPrice.ts index 7a168a79..2e75697b 100644 --- a/src/hooks/useGasPrice.ts +++ b/src/hooks/useGasPrice.ts @@ -34,7 +34,7 @@ export type TGasStationSpeed = 'fast' | 'fastest' | 'safeLow' | 'average'; * - uses ethers.estimateGas other networks * - can use currentNetworkInfo {@link TNetworkInfo.gasPrice} gasPrice as fallback * - * #### Notes + * ##### Notes * - if the gas price is unknown it returns undefined * - updates triggered by {@link BlockNumberContext} * - uses the current provider {@link ethersProvider} from {@link useEthersContext} diff --git a/src/hooks/useNonce.ts b/src/hooks/useNonce.ts index 7cfe0827..4c34ccb5 100644 --- a/src/hooks/useNonce.ts +++ b/src/hooks/useNonce.ts @@ -21,7 +21,7 @@ const queryKey: TRequiredKeys = { * #### Summary * Get the current nonce for the address provided * - * #### Notes + * ##### Notes * - updates triggered by {@link BlockNumberContext} * - uses the current provider {@link ethersProvider} from {@link useEthersContext} * diff --git a/src/hooks/useTimestamp.ts b/src/hooks/useTimestamp.ts index 52f8a5a1..40c3829d 100644 --- a/src/hooks/useTimestamp.ts +++ b/src/hooks/useTimestamp.ts @@ -18,7 +18,7 @@ const queryKey: TRequiredKeys = { namespace: keyNamespace.signer, key: 'useTimes * #### Summary * Get the current timestamp from the latest block * - * #### Notes + * ##### Notes * - updates triggered by {@link BlockNumberContext} * - uses the current provider {@link ethersProvider} from {@link useEthersContext} * diff --git a/src/models/ethersAppContextTypes.ts b/src/models/ethersAppContextTypes.ts index dff765fd..acb7a86e 100644 --- a/src/models/ethersAppContextTypes.ts +++ b/src/models/ethersAppContextTypes.ts @@ -8,7 +8,7 @@ import { TEthersProvider, TEthersSigner } from '~~/models'; * #### Summary * A callback type that returns a EthersModalConnector * - * #### Notes + * ##### Notes * - can be used by components that need to give a connector to {@link IEthersContext.openModal} * - id is the identifier of the provider: [See docs](https://github.com/Web3Modal/web3modal#connect-to-specific-provider) * diff --git a/src/models/hookOptions.ts b/src/models/hookOptions.ts index 1a961258..32d35da5 100644 --- a/src/models/hookOptions.ts +++ b/src/models/hookOptions.ts @@ -25,7 +25,7 @@ export const const_blockNumberIntervalLong: DeepPartial = { bloc * Options for hooks that describe the behviour of updates. * By default, depending on the hook, it will update every block. * - * #### Notes + * ##### Notes * The following options are available: * - interval: interval in blocknumber to update in (default 1) see {@link TUpdateOptions.blockNumberInterval} * - polling: in ms, should be over 10000ms. This is set by {@link TUpdateOptions.query.refetchInterval} @@ -65,7 +65,7 @@ export type TUpdateOptions = { * - pass in an {@link TEthersAdaptor} to override the provider * - give the alternateContextKey for a secondary context provider. * - * #### Notes + * ##### Notes * Adaptor * - To create a adaptor from a provider/signer see {@link useGetEthersAdaptorFromSignerOrProvider} * - You need to set adaptorEnabled to true diff --git a/src/models/providerTypes.ts b/src/models/providerTypes.ts index 97b91102..34144f64 100644 --- a/src/models/providerTypes.ts +++ b/src/models/providerTypes.ts @@ -11,7 +11,7 @@ import { Result } from 'ethers/lib/utils'; * #### Summary * A union of various ethers providers for ease of use and maximum flexiblity * - * #### Notes + * ##### Notes * Used by eth-hooks, eth-components and scaffold-eth-typescript * * @category Models diff --git a/yarn.lock b/yarn.lock index 04fadfeb..c7d73469 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6410,6 +6410,7 @@ __metadata: typechain: ^7.0.0 typedoc: ^0.22.10 typedoc-plugin-markdown: ^3.11.11 + typedoc-plugin-mermaid: ^1.6.0 typescript: ^4.5.4 typescript-transform-paths: ^3.3.1 use-debounce: ^7.0.1 @@ -8373,6 +8374,13 @@ __metadata: languageName: node linkType: hard +"html-escaper@npm:^3.0.0": + version: 3.0.3 + resolution: "html-escaper@npm:3.0.3" + checksum: a2678be42c15d2ef6e629775dac0925a729f4615c6593db8358b9262c7565c4627134987c00f548eb4eb76cbc3b3392f78475cd02b022f8ae7aeb9a88280831b + languageName: node + linkType: hard + "http-basic@npm:^8.1.1": version: 8.1.3 resolution: "http-basic@npm:8.1.3" @@ -15139,6 +15147,17 @@ __metadata: languageName: node linkType: hard +"typedoc-plugin-mermaid@npm:^1.6.0": + version: 1.6.0 + resolution: "typedoc-plugin-mermaid@npm:1.6.0" + dependencies: + html-escaper: ^3.0.0 + peerDependencies: + typedoc: ">=0.22.0" + checksum: 32433605b379759ffea19e9bda026c88bce253c5a4c21c45bbbd2601c9b357b7895d3e54e9c4fbba67e7371e20d67eea972d409477658afc986579920006b84c + languageName: node + linkType: hard + "typedoc@npm:^0.22.10": version: 0.22.10 resolution: "typedoc@npm:0.22.10" From a9260dc747cd4a67683782098fecd1d711163220 Mon Sep 17 00:00:00 2001 From: Shravan Sunder Date: Fri, 14 Jan 2022 20:36:07 -0500 Subject: [PATCH 13/21] #124 added emoji --- .../EthersContext.CouldNotActivateError.md | 2 +- .../EthersContext.EthersModalConnector.md | 58 +++++++------- ...ersContext.NoEthereumProviderFoundError.md | 2 +- .../EthersContext.UserClosedModalError.md | 2 +- .../classes/TestUtils.MockConnector.md | 44 +++++------ .../EthersContext.ICommonModalConnector.md | 10 +-- ....IStaticJsonRpcProviderConnectorOptions.md | 4 +- .../interfaces/Models.IEthersContext.md | 20 ++--- docs/api-typedocs/modules/EthersContext.md | 40 +++++----- docs/api-typedocs/modules/Helpers.md | 2 +- docs/api-typedocs/modules/Hooks.md | 76 +++++++++---------- docs/api-typedocs/modules/Models.md | 70 ++++++++--------- docs/api-typedocs/modules/TestUtils.md | 34 ++++----- src/context/ethers/BlockNumberContext.tsx | 4 +- src/context/ethers/EthersAppContext.tsx | 4 +- .../ethers/connectors/EthersModalConnector.ts | 8 +- .../StaticJsonRpcProviderConnector.ts | 2 +- src/hooks/dapps/useDexEthPrice.ts | 2 +- src/hooks/dapps/useDexTokenList.ts | 2 +- src/hooks/erc/useTokenBalance.ts | 2 +- src/hooks/useBalance.ts | 2 +- src/hooks/useBlockNumber.ts | 2 +- src/hooks/useBurnerSigner.ts | 2 +- src/hooks/useContractExistsAtAddress.ts | 2 +- src/hooks/useContractLoader.ts | 2 +- src/hooks/useContractReader.ts | 4 +- src/hooks/useEventListener.ts | 2 +- src/hooks/useGasPrice.ts | 2 +- src/hooks/useNonce.ts | 2 +- src/hooks/useTimestamp.ts | 2 +- src/models/ethersAppContextTypes.ts | 2 +- src/models/hookOptions.ts | 4 +- src/models/providerTypes.ts | 2 +- 33 files changed, 209 insertions(+), 209 deletions(-) diff --git a/docs/api-typedocs/classes/EthersContext.CouldNotActivateError.md b/docs/api-typedocs/classes/EthersContext.CouldNotActivateError.md index 38afbd67..c58b4bc4 100644 --- a/docs/api-typedocs/classes/EthersContext.CouldNotActivateError.md +++ b/docs/api-typedocs/classes/EthersContext.CouldNotActivateError.md @@ -162,4 +162,4 @@ Error.constructor #### Defined in -[src/context/ethers/connectors/connectorErrors.ts:16](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/context/ethers/connectors/connectorErrors.ts#L16) +[src/context/ethers/connectors/connectorErrors.ts:16](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/context/ethers/connectors/connectorErrors.ts#L16) diff --git a/docs/api-typedocs/classes/EthersContext.EthersModalConnector.md b/docs/api-typedocs/classes/EthersContext.EthersModalConnector.md index e12cc34f..76088a85 100644 --- a/docs/api-typedocs/classes/EthersContext.EthersModalConnector.md +++ b/docs/api-typedocs/classes/EthersContext.EthersModalConnector.md @@ -8,11 +8,11 @@ This is a connector for [web3-react](https://github.com/NoahZinsmeister/web3-react) that allows it to interface with [web3Modal](https://github.com/Web3Modal/web3modal). The provider selected by user via web3modal is interfaced to the web3-react context. -##### Features +##### ✨ Features - This connector used with [useEthersContext](../modules/EthersContext.md#useetherscontext) allows the app and all the hooks to effortlessly access the current network, provider, signer, address information [IEthersContext](../interfaces/Models.IEthersContext.md) - The connector centralizes and takes care of management of the web3 interaction and provides a consistent exprience for your app. -##### Notes +##### ✏️ Notes - inherits from web3-react class AbstractConnector ## Hierarchy @@ -1131,7 +1131,7 @@ ___ #### Defined in -[src/context/ethers/connectors/EthersModalConnector.ts:76](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/context/ethers/connectors/EthersModalConnector.ts#L76) +[src/context/ethers/connectors/EthersModalConnector.ts:76](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/context/ethers/connectors/EthersModalConnector.ts#L76) ___ @@ -1151,7 +1151,7 @@ ___ #### Defined in -[src/context/ethers/connectors/EthersModalConnector.ts:106](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/context/ethers/connectors/EthersModalConnector.ts#L106) +[src/context/ethers/connectors/EthersModalConnector.ts:106](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/context/ethers/connectors/EthersModalConnector.ts#L106) ___ @@ -1165,7 +1165,7 @@ ___ #### Defined in -[src/context/ethers/connectors/EthersModalConnector.ts:154](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/context/ethers/connectors/EthersModalConnector.ts#L154) +[src/context/ethers/connectors/EthersModalConnector.ts:154](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/context/ethers/connectors/EthersModalConnector.ts#L154) ___ @@ -1176,13 +1176,13 @@ ___ #### Summary Inherits from AbstractConnector. This activates web3Modal and opens the modal. -##### Notes +##### ✏️ Notes Once the user selects a provider - this will activate the provider and attach the appropriate event listeners. - get the account and signer - gets the ethers compatable provider -##### Errors +##### ⚠️ Errors - [UserClosedModalError](EthersContext.UserClosedModalError.md) - [CouldNotActivateError](EthersContext.CouldNotActivateError.md) @@ -1196,7 +1196,7 @@ AbstractConnector.activate #### Defined in -[src/context/ethers/connectors/EthersModalConnector.ts:175](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/context/ethers/connectors/EthersModalConnector.ts#L175) +[src/context/ethers/connectors/EthersModalConnector.ts:175](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/context/ethers/connectors/EthersModalConnector.ts#L175) ___ @@ -1217,7 +1217,7 @@ AbstractConnector.deactivate #### Defined in -[src/context/ethers/connectors/EthersModalConnector.ts:233](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/context/ethers/connectors/EthersModalConnector.ts#L233) +[src/context/ethers/connectors/EthersModalConnector.ts:233](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/context/ethers/connectors/EthersModalConnector.ts#L233) ___ @@ -1235,7 +1235,7 @@ AbstractConnector.getProvider #### Defined in -[src/context/ethers/connectors/EthersModalConnector.ts:253](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/context/ethers/connectors/EthersModalConnector.ts#L253) +[src/context/ethers/connectors/EthersModalConnector.ts:253](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/context/ethers/connectors/EthersModalConnector.ts#L253) ___ @@ -1253,7 +1253,7 @@ AbstractConnector.getChainId #### Defined in -[src/context/ethers/connectors/EthersModalConnector.ts:257](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/context/ethers/connectors/EthersModalConnector.ts#L257) +[src/context/ethers/connectors/EthersModalConnector.ts:257](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/context/ethers/connectors/EthersModalConnector.ts#L257) ___ @@ -1271,7 +1271,7 @@ AbstractConnector.getAccount #### Defined in -[src/context/ethers/connectors/EthersModalConnector.ts:267](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/context/ethers/connectors/EthersModalConnector.ts#L267) +[src/context/ethers/connectors/EthersModalConnector.ts:267](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/context/ethers/connectors/EthersModalConnector.ts#L267) ___ @@ -1289,7 +1289,7 @@ ___ #### Defined in -[src/context/ethers/connectors/EthersModalConnector.ts:279](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/context/ethers/connectors/EthersModalConnector.ts#L279) +[src/context/ethers/connectors/EthersModalConnector.ts:279](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/context/ethers/connectors/EthersModalConnector.ts#L279) ___ @@ -1303,7 +1303,7 @@ ___ #### Defined in -[src/context/ethers/connectors/EthersModalConnector.ts:283](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/context/ethers/connectors/EthersModalConnector.ts#L283) +[src/context/ethers/connectors/EthersModalConnector.ts:283](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/context/ethers/connectors/EthersModalConnector.ts#L283) ___ @@ -1330,7 +1330,7 @@ Change the current signer and account used by the connector #### Defined in -[src/context/ethers/connectors/EthersModalConnector.ts:294](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/context/ethers/connectors/EthersModalConnector.ts#L294) +[src/context/ethers/connectors/EthersModalConnector.ts:294](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/context/ethers/connectors/EthersModalConnector.ts#L294) ___ @@ -1344,7 +1344,7 @@ ___ #### Defined in -[src/context/ethers/connectors/EthersModalConnector.ts:305](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/context/ethers/connectors/EthersModalConnector.ts#L305) +[src/context/ethers/connectors/EthersModalConnector.ts:305](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/context/ethers/connectors/EthersModalConnector.ts#L305) ___ @@ -1365,7 +1365,7 @@ Resets the web3Modal and clears the cache #### Defined in -[src/context/ethers/connectors/EthersModalConnector.ts:313](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/context/ethers/connectors/EthersModalConnector.ts#L313) +[src/context/ethers/connectors/EthersModalConnector.ts:313](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/context/ethers/connectors/EthersModalConnector.ts#L313) ___ @@ -1392,7 +1392,7 @@ Sets the web3modal theme: light | dark | ThemeColors #### Defined in -[src/context/ethers/connectors/EthersModalConnector.ts:328](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/context/ethers/connectors/EthersModalConnector.ts#L328) +[src/context/ethers/connectors/EthersModalConnector.ts:328](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/context/ethers/connectors/EthersModalConnector.ts#L328) ## Properties @@ -1482,7 +1482,7 @@ ___ #### Defined in -[src/context/ethers/connectors/EthersModalConnector.ts:62](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/context/ethers/connectors/EthersModalConnector.ts#L62) +[src/context/ethers/connectors/EthersModalConnector.ts:62](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/context/ethers/connectors/EthersModalConnector.ts#L62) ___ @@ -1492,7 +1492,7 @@ ___ #### Defined in -[src/context/ethers/connectors/EthersModalConnector.ts:63](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/context/ethers/connectors/EthersModalConnector.ts#L63) +[src/context/ethers/connectors/EthersModalConnector.ts:63](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/context/ethers/connectors/EthersModalConnector.ts#L63) ___ @@ -1502,7 +1502,7 @@ ___ #### Defined in -[src/context/ethers/connectors/EthersModalConnector.ts:64](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/context/ethers/connectors/EthersModalConnector.ts#L64) +[src/context/ethers/connectors/EthersModalConnector.ts:64](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/context/ethers/connectors/EthersModalConnector.ts#L64) ___ @@ -1512,7 +1512,7 @@ ___ #### Defined in -[src/context/ethers/connectors/EthersModalConnector.ts:65](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/context/ethers/connectors/EthersModalConnector.ts#L65) +[src/context/ethers/connectors/EthersModalConnector.ts:65](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/context/ethers/connectors/EthersModalConnector.ts#L65) ___ @@ -1522,7 +1522,7 @@ ___ #### Defined in -[src/context/ethers/connectors/EthersModalConnector.ts:66](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/context/ethers/connectors/EthersModalConnector.ts#L66) +[src/context/ethers/connectors/EthersModalConnector.ts:66](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/context/ethers/connectors/EthersModalConnector.ts#L66) ___ @@ -1532,7 +1532,7 @@ ___ #### Defined in -[src/context/ethers/connectors/EthersModalConnector.ts:67](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/context/ethers/connectors/EthersModalConnector.ts#L67) +[src/context/ethers/connectors/EthersModalConnector.ts:67](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/context/ethers/connectors/EthersModalConnector.ts#L67) ___ @@ -1542,7 +1542,7 @@ ___ #### Defined in -[src/context/ethers/connectors/EthersModalConnector.ts:68](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/context/ethers/connectors/EthersModalConnector.ts#L68) +[src/context/ethers/connectors/EthersModalConnector.ts:68](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/context/ethers/connectors/EthersModalConnector.ts#L68) ___ @@ -1552,7 +1552,7 @@ ___ #### Defined in -[src/context/ethers/connectors/EthersModalConnector.ts:69](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/context/ethers/connectors/EthersModalConnector.ts#L69) +[src/context/ethers/connectors/EthersModalConnector.ts:69](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/context/ethers/connectors/EthersModalConnector.ts#L69) ___ @@ -1562,7 +1562,7 @@ ___ #### Defined in -[src/context/ethers/connectors/EthersModalConnector.ts:70](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/context/ethers/connectors/EthersModalConnector.ts#L70) +[src/context/ethers/connectors/EthersModalConnector.ts:70](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/context/ethers/connectors/EthersModalConnector.ts#L70) ## Constructors @@ -1585,7 +1585,7 @@ AbstractConnector.constructor #### Defined in -[src/context/ethers/connectors/EthersModalConnector.ts:86](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/context/ethers/connectors/EthersModalConnector.ts#L86) +[src/context/ethers/connectors/EthersModalConnector.ts:86](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/context/ethers/connectors/EthersModalConnector.ts#L86) ## Accessors @@ -1599,4 +1599,4 @@ AbstractConnector.constructor #### Defined in -[src/context/ethers/connectors/EthersModalConnector.ts:72](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/context/ethers/connectors/EthersModalConnector.ts#L72) +[src/context/ethers/connectors/EthersModalConnector.ts:72](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/context/ethers/connectors/EthersModalConnector.ts#L72) diff --git a/docs/api-typedocs/classes/EthersContext.NoEthereumProviderFoundError.md b/docs/api-typedocs/classes/EthersContext.NoEthereumProviderFoundError.md index dbe1f8eb..852b8104 100644 --- a/docs/api-typedocs/classes/EthersContext.NoEthereumProviderFoundError.md +++ b/docs/api-typedocs/classes/EthersContext.NoEthereumProviderFoundError.md @@ -156,4 +156,4 @@ Error.constructor #### Defined in -[src/context/ethers/connectors/connectorErrors.ts:27](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/context/ethers/connectors/connectorErrors.ts#L27) +[src/context/ethers/connectors/connectorErrors.ts:27](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/context/ethers/connectors/connectorErrors.ts#L27) diff --git a/docs/api-typedocs/classes/EthersContext.UserClosedModalError.md b/docs/api-typedocs/classes/EthersContext.UserClosedModalError.md index 34b259f5..1a945af7 100644 --- a/docs/api-typedocs/classes/EthersContext.UserClosedModalError.md +++ b/docs/api-typedocs/classes/EthersContext.UserClosedModalError.md @@ -156,4 +156,4 @@ Error.constructor #### Defined in -[src/context/ethers/connectors/connectorErrors.ts:5](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/context/ethers/connectors/connectorErrors.ts#L5) +[src/context/ethers/connectors/connectorErrors.ts:5](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/context/ethers/connectors/connectorErrors.ts#L5) diff --git a/docs/api-typedocs/classes/TestUtils.MockConnector.md b/docs/api-typedocs/classes/TestUtils.MockConnector.md index 27b501ee..e63968f2 100644 --- a/docs/api-typedocs/classes/TestUtils.MockConnector.md +++ b/docs/api-typedocs/classes/TestUtils.MockConnector.md @@ -1110,7 +1110,7 @@ ___ #### Defined in -[src/helpers/test-utils/wrapper/MockConnector.ts:33](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/helpers/test-utils/wrapper/MockConnector.ts#L33) +[src/helpers/test-utils/wrapper/MockConnector.ts:33](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/helpers/test-utils/wrapper/MockConnector.ts#L33) ___ @@ -1128,7 +1128,7 @@ ___ #### Defined in -[src/helpers/test-utils/wrapper/MockConnector.ts:39](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/helpers/test-utils/wrapper/MockConnector.ts#L39) +[src/helpers/test-utils/wrapper/MockConnector.ts:39](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/helpers/test-utils/wrapper/MockConnector.ts#L39) ___ @@ -1146,7 +1146,7 @@ ___ #### Defined in -[src/helpers/test-utils/wrapper/MockConnector.ts:43](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/helpers/test-utils/wrapper/MockConnector.ts#L43) +[src/helpers/test-utils/wrapper/MockConnector.ts:43](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/helpers/test-utils/wrapper/MockConnector.ts#L43) ___ @@ -1170,7 +1170,7 @@ ___ #### Defined in -[src/helpers/test-utils/wrapper/MockConnector.ts:46](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/helpers/test-utils/wrapper/MockConnector.ts#L46) +[src/helpers/test-utils/wrapper/MockConnector.ts:46](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/helpers/test-utils/wrapper/MockConnector.ts#L46) ___ @@ -1188,7 +1188,7 @@ ___ #### Defined in -[src/helpers/test-utils/wrapper/MockConnector.ts:49](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/helpers/test-utils/wrapper/MockConnector.ts#L49) +[src/helpers/test-utils/wrapper/MockConnector.ts:49](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/helpers/test-utils/wrapper/MockConnector.ts#L49) ___ @@ -1212,7 +1212,7 @@ ___ #### Defined in -[src/helpers/test-utils/wrapper/MockConnector.ts:53](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/helpers/test-utils/wrapper/MockConnector.ts#L53) +[src/helpers/test-utils/wrapper/MockConnector.ts:53](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/helpers/test-utils/wrapper/MockConnector.ts#L53) ___ @@ -1230,7 +1230,7 @@ AbstractConnector.activate #### Defined in -[src/helpers/test-utils/wrapper/MockConnector.ts:61](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/helpers/test-utils/wrapper/MockConnector.ts#L61) +[src/helpers/test-utils/wrapper/MockConnector.ts:61](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/helpers/test-utils/wrapper/MockConnector.ts#L61) ___ @@ -1248,7 +1248,7 @@ AbstractConnector.getProvider #### Defined in -[src/helpers/test-utils/wrapper/MockConnector.ts:69](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/helpers/test-utils/wrapper/MockConnector.ts#L69) +[src/helpers/test-utils/wrapper/MockConnector.ts:69](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/helpers/test-utils/wrapper/MockConnector.ts#L69) ___ @@ -1266,7 +1266,7 @@ AbstractConnector.getChainId #### Defined in -[src/helpers/test-utils/wrapper/MockConnector.ts:73](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/helpers/test-utils/wrapper/MockConnector.ts#L73) +[src/helpers/test-utils/wrapper/MockConnector.ts:73](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/helpers/test-utils/wrapper/MockConnector.ts#L73) ___ @@ -1284,7 +1284,7 @@ AbstractConnector.getAccount #### Defined in -[src/helpers/test-utils/wrapper/MockConnector.ts:77](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/helpers/test-utils/wrapper/MockConnector.ts#L77) +[src/helpers/test-utils/wrapper/MockConnector.ts:77](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/helpers/test-utils/wrapper/MockConnector.ts#L77) ___ @@ -1304,7 +1304,7 @@ ___ #### Defined in -[src/helpers/test-utils/wrapper/MockConnector.ts:82](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/helpers/test-utils/wrapper/MockConnector.ts#L82) +[src/helpers/test-utils/wrapper/MockConnector.ts:82](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/helpers/test-utils/wrapper/MockConnector.ts#L82) ___ @@ -1322,7 +1322,7 @@ AbstractConnector.deactivate #### Defined in -[src/helpers/test-utils/wrapper/MockConnector.ts:87](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/helpers/test-utils/wrapper/MockConnector.ts#L87) +[src/helpers/test-utils/wrapper/MockConnector.ts:87](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/helpers/test-utils/wrapper/MockConnector.ts#L87) ## Properties @@ -1412,7 +1412,7 @@ ___ #### Defined in -[src/helpers/test-utils/wrapper/MockConnector.ts:14](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/helpers/test-utils/wrapper/MockConnector.ts#L14) +[src/helpers/test-utils/wrapper/MockConnector.ts:14](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/helpers/test-utils/wrapper/MockConnector.ts#L14) ___ @@ -1422,7 +1422,7 @@ ___ #### Defined in -[src/helpers/test-utils/wrapper/MockConnector.ts:15](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/helpers/test-utils/wrapper/MockConnector.ts#L15) +[src/helpers/test-utils/wrapper/MockConnector.ts:15](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/helpers/test-utils/wrapper/MockConnector.ts#L15) ___ @@ -1432,7 +1432,7 @@ ___ #### Defined in -[src/helpers/test-utils/wrapper/MockConnector.ts:17](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/helpers/test-utils/wrapper/MockConnector.ts#L17) +[src/helpers/test-utils/wrapper/MockConnector.ts:17](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/helpers/test-utils/wrapper/MockConnector.ts#L17) ___ @@ -1442,7 +1442,7 @@ ___ #### Defined in -[src/helpers/test-utils/wrapper/MockConnector.ts:18](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/helpers/test-utils/wrapper/MockConnector.ts#L18) +[src/helpers/test-utils/wrapper/MockConnector.ts:18](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/helpers/test-utils/wrapper/MockConnector.ts#L18) ___ @@ -1452,7 +1452,7 @@ ___ #### Defined in -[src/helpers/test-utils/wrapper/MockConnector.ts:20](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/helpers/test-utils/wrapper/MockConnector.ts#L20) +[src/helpers/test-utils/wrapper/MockConnector.ts:20](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/helpers/test-utils/wrapper/MockConnector.ts#L20) ___ @@ -1462,7 +1462,7 @@ ___ #### Defined in -[src/helpers/test-utils/wrapper/MockConnector.ts:21](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/helpers/test-utils/wrapper/MockConnector.ts#L21) +[src/helpers/test-utils/wrapper/MockConnector.ts:21](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/helpers/test-utils/wrapper/MockConnector.ts#L21) ___ @@ -1472,7 +1472,7 @@ ___ #### Defined in -[src/helpers/test-utils/wrapper/MockConnector.ts:22](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/helpers/test-utils/wrapper/MockConnector.ts#L22) +[src/helpers/test-utils/wrapper/MockConnector.ts:22](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/helpers/test-utils/wrapper/MockConnector.ts#L22) ___ @@ -1482,7 +1482,7 @@ ___ #### Defined in -[src/helpers/test-utils/wrapper/MockConnector.ts:23](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/helpers/test-utils/wrapper/MockConnector.ts#L23) +[src/helpers/test-utils/wrapper/MockConnector.ts:23](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/helpers/test-utils/wrapper/MockConnector.ts#L23) ___ @@ -1492,7 +1492,7 @@ ___ #### Defined in -[src/helpers/test-utils/wrapper/MockConnector.ts:24](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/helpers/test-utils/wrapper/MockConnector.ts#L24) +[src/helpers/test-utils/wrapper/MockConnector.ts:24](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/helpers/test-utils/wrapper/MockConnector.ts#L24) ## Constructors @@ -1512,4 +1512,4 @@ AbstractConnector.constructor #### Defined in -[src/helpers/test-utils/wrapper/MockConnector.ts:26](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/helpers/test-utils/wrapper/MockConnector.ts#L26) +[src/helpers/test-utils/wrapper/MockConnector.ts:26](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/helpers/test-utils/wrapper/MockConnector.ts#L26) diff --git a/docs/api-typedocs/interfaces/EthersContext.ICommonModalConnector.md b/docs/api-typedocs/interfaces/EthersContext.ICommonModalConnector.md index b403e260..d8926ffb 100644 --- a/docs/api-typedocs/interfaces/EthersContext.ICommonModalConnector.md +++ b/docs/api-typedocs/interfaces/EthersContext.ICommonModalConnector.md @@ -34,7 +34,7 @@ An interface implemented by [EthersModalConnector](../classes/EthersContext.Ethe #### Defined in -[src/context/ethers/connectors/EthersModalConnector.ts:38](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/context/ethers/connectors/EthersModalConnector.ts#L38) +[src/context/ethers/connectors/EthersModalConnector.ts:38](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/context/ethers/connectors/EthersModalConnector.ts#L38) ___ @@ -54,7 +54,7 @@ ___ #### Defined in -[src/context/ethers/connectors/EthersModalConnector.ts:39](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/context/ethers/connectors/EthersModalConnector.ts#L39) +[src/context/ethers/connectors/EthersModalConnector.ts:39](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/context/ethers/connectors/EthersModalConnector.ts#L39) ___ @@ -68,7 +68,7 @@ ___ #### Defined in -[src/context/ethers/connectors/EthersModalConnector.ts:40](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/context/ethers/connectors/EthersModalConnector.ts#L40) +[src/context/ethers/connectors/EthersModalConnector.ts:40](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/context/ethers/connectors/EthersModalConnector.ts#L40) ___ @@ -88,7 +88,7 @@ ___ #### Defined in -[src/context/ethers/connectors/EthersModalConnector.ts:41](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/context/ethers/connectors/EthersModalConnector.ts#L41) +[src/context/ethers/connectors/EthersModalConnector.ts:41](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/context/ethers/connectors/EthersModalConnector.ts#L41) ___ @@ -102,4 +102,4 @@ ___ #### Defined in -[src/context/ethers/connectors/EthersModalConnector.ts:42](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/context/ethers/connectors/EthersModalConnector.ts#L42) +[src/context/ethers/connectors/EthersModalConnector.ts:42](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/context/ethers/connectors/EthersModalConnector.ts#L42) diff --git a/docs/api-typedocs/interfaces/EthersContext.IStaticJsonRpcProviderConnectorOptions.md b/docs/api-typedocs/interfaces/EthersContext.IStaticJsonRpcProviderConnectorOptions.md index 3cae5e2f..e29c1633 100644 --- a/docs/api-typedocs/interfaces/EthersContext.IStaticJsonRpcProviderConnectorOptions.md +++ b/docs/api-typedocs/interfaces/EthersContext.IStaticJsonRpcProviderConnectorOptions.md @@ -48,7 +48,7 @@ ___ #### Defined in -[src/context/ethers/connectors/StaticJsonRpcProviderConnector.ts:12](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/context/ethers/connectors/StaticJsonRpcProviderConnector.ts#L12) +[src/context/ethers/connectors/StaticJsonRpcProviderConnector.ts:12](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/context/ethers/connectors/StaticJsonRpcProviderConnector.ts#L12) ___ @@ -58,4 +58,4 @@ ___ #### Defined in -[src/context/ethers/connectors/StaticJsonRpcProviderConnector.ts:13](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/context/ethers/connectors/StaticJsonRpcProviderConnector.ts#L13) +[src/context/ethers/connectors/StaticJsonRpcProviderConnector.ts:13](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/context/ethers/connectors/StaticJsonRpcProviderConnector.ts#L13) diff --git a/docs/api-typedocs/interfaces/Models.IEthersContext.md b/docs/api-typedocs/interfaces/Models.IEthersContext.md index 6f7d59d8..f9f964ce 100644 --- a/docs/api-typedocs/interfaces/Models.IEthersContext.md +++ b/docs/api-typedocs/interfaces/Models.IEthersContext.md @@ -126,7 +126,7 @@ ___ #### Defined in -[src/models/ethersAppContextTypes.ts:37](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/models/ethersAppContextTypes.ts#L37) +[src/models/ethersAppContextTypes.ts:37](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/models/ethersAppContextTypes.ts#L37) ___ @@ -140,7 +140,7 @@ ___ #### Defined in -[src/models/ethersAppContextTypes.ts:38](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/models/ethersAppContextTypes.ts#L38) +[src/models/ethersAppContextTypes.ts:38](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/models/ethersAppContextTypes.ts#L38) ## Properties @@ -182,7 +182,7 @@ Web3ReactContextInterface.connector #### Defined in -[src/models/ethersAppContextTypes.ts:30](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/models/ethersAppContextTypes.ts#L30) +[src/models/ethersAppContextTypes.ts:30](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/models/ethersAppContextTypes.ts#L30) ___ @@ -192,7 +192,7 @@ ___ #### Defined in -[src/models/ethersAppContextTypes.ts:31](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/models/ethersAppContextTypes.ts#L31) +[src/models/ethersAppContextTypes.ts:31](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/models/ethersAppContextTypes.ts#L31) ___ @@ -206,7 +206,7 @@ Web3ReactContextInterface.active #### Defined in -[src/models/ethersAppContextTypes.ts:32](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/models/ethersAppContextTypes.ts#L32) +[src/models/ethersAppContextTypes.ts:32](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/models/ethersAppContextTypes.ts#L32) ___ @@ -216,7 +216,7 @@ ___ #### Defined in -[src/models/ethersAppContextTypes.ts:33](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/models/ethersAppContextTypes.ts#L33) +[src/models/ethersAppContextTypes.ts:33](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/models/ethersAppContextTypes.ts#L33) ___ @@ -230,7 +230,7 @@ Web3ReactContextInterface.account #### Defined in -[src/models/ethersAppContextTypes.ts:34](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/models/ethersAppContextTypes.ts#L34) +[src/models/ethersAppContextTypes.ts:34](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/models/ethersAppContextTypes.ts#L34) ___ @@ -244,7 +244,7 @@ Web3ReactContextInterface.chainId #### Defined in -[src/models/ethersAppContextTypes.ts:35](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/models/ethersAppContextTypes.ts#L35) +[src/models/ethersAppContextTypes.ts:35](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/models/ethersAppContextTypes.ts#L35) ___ @@ -254,7 +254,7 @@ ___ #### Defined in -[src/models/ethersAppContextTypes.ts:36](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/models/ethersAppContextTypes.ts#L36) +[src/models/ethersAppContextTypes.ts:36](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/models/ethersAppContextTypes.ts#L36) ___ @@ -264,4 +264,4 @@ ___ #### Defined in -[src/models/ethersAppContextTypes.ts:39](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/models/ethersAppContextTypes.ts#L39) +[src/models/ethersAppContextTypes.ts:39](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/models/ethersAppContextTypes.ts#L39) diff --git a/docs/api-typedocs/modules/EthersContext.md b/docs/api-typedocs/modules/EthersContext.md index d70591cf..3a012838 100644 --- a/docs/api-typedocs/modules/EthersContext.md +++ b/docs/api-typedocs/modules/EthersContext.md @@ -61,11 +61,11 @@ A context for your react app with [useEthersContext](EthersContext.md#useethersc A hook that gets you the current blocknumber via react context - can be shared by your whole app. -##### Use +##### ❔Use Make sure to wrap your main app with the [EthersAppContext](EthersContext.md#ethersappcontext). - See [scaffold-eth-typescript example](https://github.com/scaffold-eth/scaffold-eth-typescript/blob/0225179a2a8bb7b3a255d6eff4802b47d72809dd/packages/vite-app-ts/src/components/routes/App.tsx#L38) -##### Notes +##### ✏️ Notes - this extensively used by eth-hooks to trigger hooks when a new block arrives - uses the current provider {@link ethersProvider} from [useEthersContext](EthersContext.md#useetherscontext) @@ -77,7 +77,7 @@ current block number #### Defined in -[src/context/ethers/BlockNumberContext.tsx:64](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/context/ethers/BlockNumberContext.tsx#L64) +[src/context/ethers/BlockNumberContext.tsx:64](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/context/ethers/BlockNumberContext.tsx#L64) ___ @@ -89,14 +89,14 @@ ___ This Hook provides you with access to the current Ethers Provider Context. This provider would be the one selected by using [EthersModalConnector](../classes/EthersContext.EthersModalConnector.md) and Web3Modal -##### Features +##### ✨ Features Gives you access to consistent interface to get the current provider information [EthersModalConnector](../classes/EthersContext.EthersModalConnector.md) - ethers compatable provider [TEthersProvider](Models.md#tethersprovider) - a callback to change the current account (signer) - the current account, chainId and signer - callbacks to open the web3Modal, logout or change theme -##### Notes +##### ✏️ Notes - currently providerKey isnt being used #### Parameters @@ -111,7 +111,7 @@ Gives you access to consistent interface to get the current provider information #### Defined in -[src/context/ethers/EthersAppContext.tsx:37](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/context/ethers/EthersAppContext.tsx#L37) +[src/context/ethers/EthersAppContext.tsx:37](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/context/ethers/EthersAppContext.tsx#L37) ___ @@ -123,7 +123,7 @@ ___ A connector that can be used by apps to connect to a StaticJsonRpcProvider - For example you can use this to connect to a localhost provider -##### Notes +##### ✏️ Notes See scaffold-eth-typescript for an example that uses it to connect to a localhost burner wallet. - [scaffold-eth-typescript example](https://github.com/scaffold-eth/scaffold-eth-typescript/blob/0225179a2a8bb7b3a255d6eff4802b47d72809dd/packages/vite-app-ts/src/config/web3ModalConfig.ts#L86) @@ -140,7 +140,7 @@ See scaffold-eth-typescript for an example that uses it to connect to a localhos #### Defined in -[src/context/ethers/connectors/StaticJsonRpcProviderConnector.ts:31](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/context/ethers/connectors/StaticJsonRpcProviderConnector.ts#L31) +[src/context/ethers/connectors/StaticJsonRpcProviderConnector.ts:31](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/context/ethers/connectors/StaticJsonRpcProviderConnector.ts#L31) ___ @@ -172,7 +172,7 @@ ___ #### Defined in -[src/context/app-contracts/contractConnectors.ts:44](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/context/app-contracts/contractConnectors.ts#L44) +[src/context/app-contracts/contractConnectors.ts:44](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/context/app-contracts/contractConnectors.ts#L44) ___ @@ -202,7 +202,7 @@ ___ #### Defined in -[src/context/app-contracts/contractConnectors.ts:74](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/context/app-contracts/contractConnectors.ts#L74) +[src/context/app-contracts/contractConnectors.ts:74](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/context/app-contracts/contractConnectors.ts#L74) ___ @@ -230,7 +230,7 @@ ___ #### Defined in -[src/context/app-contracts/contractConnectors.ts:104](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/context/app-contracts/contractConnectors.ts#L104) +[src/context/app-contracts/contractConnectors.ts:104](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/context/app-contracts/contractConnectors.ts#L104) ___ @@ -259,7 +259,7 @@ ___ #### Defined in -[src/context/app-contracts/contractConnectors.ts:120](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/context/app-contracts/contractConnectors.ts#L120) +[src/context/app-contracts/contractConnectors.ts:120](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/context/app-contracts/contractConnectors.ts#L120) ___ @@ -295,7 +295,7 @@ ___ #### Defined in -[src/context/app-contracts/contractsContextFactory.tsx:79](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/context/app-contracts/contractsContextFactory.tsx#L79) +[src/context/app-contracts/contractsContextFactory.tsx:79](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/context/app-contracts/contractsContextFactory.tsx#L79) ## Type aliases @@ -311,7 +311,7 @@ ___ #### Defined in -[src/context/app-contracts/contractsContextFactory.tsx:22](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/context/app-contracts/contractsContextFactory.tsx#L22) +[src/context/app-contracts/contractsContextFactory.tsx:22](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/context/app-contracts/contractsContextFactory.tsx#L22) ___ @@ -338,7 +338,7 @@ ___ #### Defined in -[src/context/app-contracts/contractsContextFactory.tsx:60](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/context/app-contracts/contractsContextFactory.tsx#L60) +[src/context/app-contracts/contractsContextFactory.tsx:60](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/context/app-contracts/contractsContextFactory.tsx#L60) ___ @@ -360,7 +360,7 @@ Props for context that allow you specify alternate web3ReactRoot [See docs](http #### Defined in -[src/context/ethers/EthersAppContext.tsx:97](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/context/ethers/EthersAppContext.tsx#L97) +[src/context/ethers/EthersAppContext.tsx:97](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/context/ethers/EthersAppContext.tsx#L97) ___ @@ -370,7 +370,7 @@ ___ #### Defined in -[src/context/ethers/connectors/EthersModalConnector.ts:45](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/context/ethers/connectors/EthersModalConnector.ts#L45) +[src/context/ethers/connectors/EthersModalConnector.ts:45](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/context/ethers/connectors/EthersModalConnector.ts#L45) ## EthersContext Variables @@ -387,7 +387,7 @@ A context that works with [useBlockNumberContext](EthersContext.md#useblocknumbe #### Defined in -[src/context/ethers/BlockNumberContext.tsx:86](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/context/ethers/BlockNumberContext.tsx#L86) +[src/context/ethers/BlockNumberContext.tsx:86](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/context/ethers/BlockNumberContext.tsx#L86) ___ @@ -405,7 +405,7 @@ This is a wrapper around Web3ReactProvider that provides additional functionalit #### Defined in -[src/context/ethers/EthersAppContext.tsx:144](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/context/ethers/EthersAppContext.tsx#L144) +[src/context/ethers/EthersAppContext.tsx:144](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/context/ethers/EthersAppContext.tsx#L144) ___ @@ -417,4 +417,4 @@ ___ #### Defined in -[src/context/ethers/queryClient.ts:3](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/context/ethers/queryClient.ts#L3) +[src/context/ethers/queryClient.ts:3](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/context/ethers/queryClient.ts#L3) diff --git a/docs/api-typedocs/modules/Helpers.md b/docs/api-typedocs/modules/Helpers.md index c2119a0f..740f259b 100644 --- a/docs/api-typedocs/modules/Helpers.md +++ b/docs/api-typedocs/modules/Helpers.md @@ -43,4 +43,4 @@ const ExampleUI = lazier(() => import('./exampleui/ExampleUI'), 'ExampleUI'); #### Defined in -[src/helpers/lazier.ts:18](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/helpers/lazier.ts#L18) +[src/helpers/lazier.ts:18](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/helpers/lazier.ts#L18) diff --git a/docs/api-typedocs/modules/Hooks.md b/docs/api-typedocs/modules/Hooks.md index 0b45735c..62ca3835 100644 --- a/docs/api-typedocs/modules/Hooks.md +++ b/docs/api-typedocs/modules/Hooks.md @@ -51,7 +51,7 @@ Commonly used ethereum hooks to turbocharge your development! Works with [useEt #### Summary Get the Exchange price of ETH/USD (extrapolated from WETH/DAI) from uniswap -##### Notes +##### ✏️ Notes - uses useOnRepetition, does not use context #### Parameters @@ -70,7 +70,7 @@ price in USD #### Defined in -[src/hooks/dapps/useDexEthPrice.ts:27](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/hooks/dapps/useDexEthPrice.ts#L27) +[src/hooks/dapps/useDexEthPrice.ts:27](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/hooks/dapps/useDexEthPrice.ts#L27) ___ @@ -81,7 +81,7 @@ ___ #### Summary Gets a tokenlist from uniswap ipfs tokenlist -#### Note +##### ✏️ Notes - you can also point it to another URI #### Parameters @@ -100,7 +100,7 @@ Gets a tokenlist from uniswap ipfs tokenlist #### Defined in -[src/hooks/dapps/useDexTokenList.ts:27](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/hooks/dapps/useDexTokenList.ts#L27) +[src/hooks/dapps/useDexTokenList.ts:27](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/hooks/dapps/useDexTokenList.ts#L27) ___ @@ -124,7 +124,7 @@ Gets the address from an ENS name #### Defined in -[src/hooks/dapps/useResolveEnsAddress.ts:19](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/hooks/dapps/useResolveEnsAddress.ts#L19) +[src/hooks/dapps/useResolveEnsAddress.ts:19](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/hooks/dapps/useResolveEnsAddress.ts#L19) ___ @@ -148,7 +148,7 @@ Gets ENS name for given address #### Defined in -[src/hooks/dapps/useResolveEnsName.ts:45](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/hooks/dapps/useResolveEnsName.ts#L45) +[src/hooks/dapps/useResolveEnsName.ts:45](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/hooks/dapps/useResolveEnsName.ts#L45) ___ @@ -160,7 +160,7 @@ ___ Get the balance of an ERC20 token in an address - uses the ethers.Contract object's provider to access the network -##### Notes +##### ✏️ Notes - uses useOnRepetition #### Type parameters @@ -183,7 +183,7 @@ Get the balance of an ERC20 token in an address #### Defined in -[src/hooks/erc/useTokenBalance.ts:33](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/hooks/erc/useTokenBalance.ts#L33) +[src/hooks/erc/useTokenBalance.ts:33](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/hooks/erc/useTokenBalance.ts#L33) ___ @@ -207,7 +207,7 @@ Are the signers equal and valid #### Defined in -[src/hooks/useAreSignerEqual.ts:17](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/hooks/useAreSignerEqual.ts#L17) +[src/hooks/useAreSignerEqual.ts:17](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/hooks/useAreSignerEqual.ts#L17) ___ @@ -218,7 +218,7 @@ ___ #### Summary Gets your balance in ETH for the given address. -##### Notes +##### ✏️ Notes - updates triggered by [BlockNumberContext](EthersContext.md#blocknumbercontext) - uses the current provider {@link provider} from [useEthersContext](EthersContext.md#useetherscontext) @@ -245,7 +245,7 @@ current balance #### Defined in -[src/hooks/useBalance.ts:34](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/hooks/useBalance.ts#L34) +[src/hooks/useBalance.ts:34](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/hooks/useBalance.ts#L34) ___ @@ -256,7 +256,7 @@ ___ #### Summary Get the current block number of the network. ✋🏽 @deprecated -##### Notes +##### ✏️ Notes - ✋🏽 For app wide block number access use [useBlockNumberContext](EthersContext.md#useblocknumbercontext) instead. See [BlockNumberContext](EthersContext.md#blocknumbercontext) for more details, you get this as part of [EthersAppContext](EthersContext.md#ethersappcontext) - uses the current provided block number @@ -275,7 +275,7 @@ block number #### Defined in -[src/hooks/useBlockNumber.ts:19](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/hooks/useBlockNumber.ts#L19) +[src/hooks/useBlockNumber.ts:19](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/hooks/useBlockNumber.ts#L19) ___ @@ -301,7 +301,7 @@ IBurnerSigner #### Defined in -[src/hooks/useBurnerSigner.ts:87](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/hooks/useBurnerSigner.ts#L87) +[src/hooks/useBurnerSigner.ts:87](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/hooks/useBurnerSigner.ts#L87) ___ @@ -312,7 +312,7 @@ ___ #### Summary Checks whether a contract exists on the blockchain -##### Notes +##### ✏️ Notes - uses the ethers.Contract object's provider to access the network - checks the contract address to see if the contract is deployed @@ -329,7 +329,7 @@ Checks whether a contract exists on the blockchain #### Defined in -[src/hooks/useContractExistsAtAddress.ts:25](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/hooks/useContractExistsAtAddress.ts#L25) +[src/hooks/useContractExistsAtAddress.ts:25](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/hooks/useContractExistsAtAddress.ts#L25) ___ @@ -341,7 +341,7 @@ ___ Loads your contracts and returns them. ✋🏽 @deprecated Gives options to read values from contracts or write transactions into them. -##### Notes +##### ✏️ Notes - ✋🏽 For easy app wide contract access use {@link AppContractContex} created by [contractsContextFactory](EthersContext.md#contractscontextfactory). See [contractsContextFactory](EthersContext.md#contractscontextfactory) for more details. A optional providerOrSigner is needed to initalize the contract class @@ -367,7 +367,7 @@ Record of contractName:Contracts #### Defined in -[src/hooks/useContractLoader.ts:105](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/hooks/useContractLoader.ts#L105) +[src/hooks/useContractLoader.ts:105](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/hooks/useContractLoader.ts#L105) ___ @@ -378,7 +378,7 @@ ___ #### Summary Enables you to call a contract function with arguments and receive the output. You can use this to easily track of contract outputs in react states -##### Notes +##### ✏️ Notes - uses the ethers.Contract object's provider to access the network - formatter is a function that can change the format of the output @@ -406,7 +406,7 @@ Enables you to call a contract function with arguments and receive the output. #### Defined in -[src/hooks/useContractReader.ts:109](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/hooks/useContractReader.ts#L109) +[src/hooks/useContractReader.ts:109](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/hooks/useContractReader.ts#L109) ___ @@ -430,7 +430,7 @@ Gets the user {@link TEthersUser} for a signer or wallet #### Defined in -[src/hooks/useEthersAdaptorFromProviderOrSigners.ts:30](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/hooks/useEthersAdaptorFromProviderOrSigners.ts#L30) +[src/hooks/useEthersAdaptorFromProviderOrSigners.ts:30](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/hooks/useEthersAdaptorFromProviderOrSigners.ts#L30) ___ @@ -441,7 +441,7 @@ ___ #### Summary Tracks the events of associated with a contract -##### Notes +##### ✏️ Notes - updates triggered through ethers event listener - uses the current provider {@link ethersProvider} from [useEthersContext](EthersContext.md#useetherscontext) @@ -467,7 +467,7 @@ Tracks the events of associated with a contract #### Defined in -[src/hooks/useEventListener.ts:26](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/hooks/useEventListener.ts#L26) +[src/hooks/useEventListener.ts:26](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/hooks/useEventListener.ts#L26) ___ @@ -481,7 +481,7 @@ Gets the gas price for the current network as gwei - uses ethers.estimateGas other networks - can use currentNetworkInfo {@link TNetworkInfo.gasPrice} gasPrice as fallback -##### Notes +##### ✏️ Notes - if the gas price is unknown it returns undefined - updates triggered by [BlockNumberContext](EthersContext.md#blocknumbercontext) - uses the current provider {@link ethersProvider} from [useEthersContext](EthersContext.md#useetherscontext) @@ -504,7 +504,7 @@ gas as gwei #### Defined in -[src/hooks/useGasPrice.ts:48](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/hooks/useGasPrice.ts#L48) +[src/hooks/useGasPrice.ts:48](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/hooks/useGasPrice.ts#L48) ___ @@ -515,7 +515,7 @@ ___ #### Summary Get the current nonce for the address provided -##### Notes +##### ✏️ Notes - updates triggered by [BlockNumberContext](EthersContext.md#blocknumbercontext) - uses the current provider {@link ethersProvider} from [useEthersContext](EthersContext.md#useetherscontext) @@ -533,7 +533,7 @@ Get the current nonce for the address provided #### Defined in -[src/hooks/useNonce.ts:33](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/hooks/useNonce.ts#L33) +[src/hooks/useNonce.ts:33](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/hooks/useNonce.ts#L33) ___ @@ -556,7 +556,7 @@ Get the address from the signer #### Defined in -[src/hooks/useSignerAddress.ts:19](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/hooks/useSignerAddress.ts#L19) +[src/hooks/useSignerAddress.ts:19](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/hooks/useSignerAddress.ts#L19) ___ @@ -580,7 +580,7 @@ Get the address from the signer #### Defined in -[src/hooks/useSignerChainId.ts:20](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/hooks/useSignerChainId.ts#L20) +[src/hooks/useSignerChainId.ts:20](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/hooks/useSignerChainId.ts#L20) ___ @@ -591,7 +591,7 @@ ___ #### Summary Get the current timestamp from the latest block -##### Notes +##### ✏️ Notes - updates triggered by [BlockNumberContext](EthersContext.md#blocknumbercontext) - uses the current provider {@link ethersProvider} from [useEthersContext](EthersContext.md#useetherscontext) @@ -608,7 +608,7 @@ Get the current timestamp from the latest block #### Defined in -[src/hooks/useTimestamp.ts:30](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/hooks/useTimestamp.ts#L30) +[src/hooks/useTimestamp.ts:30](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/hooks/useTimestamp.ts#L30) ___ @@ -631,7 +631,7 @@ ___ #### Defined in -[src/hooks/useContractLoader.ts:59](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/hooks/useContractLoader.ts#L59) +[src/hooks/useContractLoader.ts:59](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/hooks/useContractLoader.ts#L59) ___ @@ -642,7 +642,7 @@ ___ #### Summary Enables you to call a contract function with arguments and receive the output. You can use this to easily track of contract outputs in react states -##### Notes +##### ✏️ Notes - uses the ethers.Contract object's provider to access the network - formatter is a function that can change the format of the output @@ -669,7 +669,7 @@ Enables you to call a contract function with arguments and receive the output. #### Defined in -[src/hooks/useContractReader.ts:27](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/hooks/useContractReader.ts#L27) +[src/hooks/useContractReader.ts:27](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/hooks/useContractReader.ts#L27) ## Hooks Type aliases @@ -680,7 +680,7 @@ Enables you to call a contract function with arguments and receive the output. #### Summary Return type of useBurnerSigner: -##### Notes +##### ✏️ Notes - provides signer - methods of interacting with burner signer - methods to save and loadd signer from local storage @@ -698,7 +698,7 @@ Return type of useBurnerSigner: #### Defined in -[src/hooks/useBurnerSigner.ts:56](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/hooks/useBurnerSigner.ts#L56) +[src/hooks/useBurnerSigner.ts:56](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/hooks/useBurnerSigner.ts#L56) ___ @@ -714,7 +714,7 @@ Preset speeds for Eth Gas Station API #### Defined in -[src/hooks/useGasPrice.ts:28](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/hooks/useGasPrice.ts#L28) +[src/hooks/useGasPrice.ts:28](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/hooks/useGasPrice.ts#L28) ___ @@ -738,4 +738,4 @@ Configuration for useContractLoader #### Defined in -[src/hooks/useContractLoader.ts:39](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/hooks/useContractLoader.ts#L39) +[src/hooks/useContractLoader.ts:39](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/hooks/useContractLoader.ts#L39) diff --git a/docs/api-typedocs/modules/Models.md b/docs/api-typedocs/modules/Models.md index 77a420d1..f4d2d4db 100644 --- a/docs/api-typedocs/modules/Models.md +++ b/docs/api-typedocs/modules/Models.md @@ -67,7 +67,7 @@ Types and constants to make it easier to interact with ethers. #### Defined in -[src/models/constants/common.ts:1](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/models/constants/common.ts#L1) +[src/models/constants/common.ts:1](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/models/constants/common.ts#L1) ___ @@ -86,7 +86,7 @@ ___ #### Defined in -[src/models/constants/keyNamespace.ts:1](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/models/constants/keyNamespace.ts#L1) +[src/models/constants/keyNamespace.ts:1](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/models/constants/keyNamespace.ts#L1) ___ @@ -99,7 +99,7 @@ An constant for block number interval of 10 blocks #### Defined in -[src/models/hookOptions.ts:9](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/models/hookOptions.ts#L9) +[src/models/hookOptions.ts:9](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/models/hookOptions.ts#L9) ___ @@ -112,7 +112,7 @@ An constant for block number interval of 50 blocks #### Defined in -[src/models/hookOptions.ts:15](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/models/hookOptions.ts#L15) +[src/models/hookOptions.ts:15](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/models/hookOptions.ts#L15) ___ @@ -125,7 +125,7 @@ An constant for block number interval of 250 blocks #### Defined in -[src/models/hookOptions.ts:21](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/models/hookOptions.ts#L21) +[src/models/hookOptions.ts:21](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/models/hookOptions.ts#L21) ## EthersContext Type aliases @@ -140,7 +140,7 @@ An constant for block number interval of 250 blocks #### Summary A callback type that returns a EthersModalConnector -##### Notes +##### ✏️ Notes - can be used by components that need to give a connector to [IEthersContext.openModal](../interfaces/Models.IEthersContext.md#openmodal) - id is the identifier of the provider: [See docs](https://github.com/Web3Modal/web3modal#connect-to-specific-provider) @@ -156,7 +156,7 @@ A callback type that returns a EthersModalConnector #### Defined in -[src/models/ethersAppContextTypes.ts:17](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/models/ethersAppContextTypes.ts#L17) +[src/models/ethersAppContextTypes.ts:17](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/models/ethersAppContextTypes.ts#L17) ___ @@ -177,7 +177,7 @@ Describes the structure of hardhat_contracts.json #### Defined in -[src/models/contractTypes.ts:30](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/models/contractTypes.ts#L30) +[src/models/contractTypes.ts:30](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/models/contractTypes.ts#L30) ___ @@ -197,7 +197,7 @@ A type for external contracts #### Defined in -[src/models/contractTypes.ts:54](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/models/contractTypes.ts#L54) +[src/models/contractTypes.ts:54](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/models/contractTypes.ts#L54) ___ @@ -221,7 +221,7 @@ Contract function information: #### Defined in -[src/models/contractTypes.ts:69](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/models/contractTypes.ts#L69) +[src/models/contractTypes.ts:69](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/models/contractTypes.ts#L69) ___ @@ -247,7 +247,7 @@ A type that describes the basics of a network for applications. e.g. mainnet, ro #### Defined in -[src/models/networkTypes.ts:7](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/models/networkTypes.ts#L7) +[src/models/networkTypes.ts:7](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/models/networkTypes.ts#L7) ___ @@ -258,12 +258,12 @@ ___ #### Summary A union of various ethers providers for ease of use and maximum flexiblity -##### Notes +##### ✏️ Notes Used by eth-hooks, eth-components and scaffold-eth-typescript #### Defined in -[src/models/providerTypes.ts:19](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/models/providerTypes.ts#L19) +[src/models/providerTypes.ts:19](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/models/providerTypes.ts#L19) ___ @@ -276,7 +276,7 @@ A union of various providers and signers in ethers to give maximum flexibility #### Defined in -[src/models/providerTypes.ts:27](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/models/providerTypes.ts#L27) +[src/models/providerTypes.ts:27](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/models/providerTypes.ts#L27) ___ @@ -289,7 +289,7 @@ A union of various providers in ethers to give maximum flexibility #### Defined in -[src/models/providerTypes.ts:42](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/models/providerTypes.ts#L42) +[src/models/providerTypes.ts:42](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/models/providerTypes.ts#L42) ___ @@ -302,7 +302,7 @@ A union of abstract, non initalizable providers, used by some functions #### Defined in -[src/models/providerTypes.ts:50](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/models/providerTypes.ts#L50) +[src/models/providerTypes.ts:50](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/models/providerTypes.ts#L50) ___ @@ -322,7 +322,7 @@ An generic extension of EventFilter that is used by TypedEvent. It allows for t #### Defined in -[src/models/providerTypes.ts:58](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/models/providerTypes.ts#L58) +[src/models/providerTypes.ts:58](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/models/providerTypes.ts#L58) ___ @@ -341,7 +341,7 @@ An generic extension of Event. It types the the arguments and return values of #### Defined in -[src/models/providerTypes.ts:69](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/models/providerTypes.ts#L69) +[src/models/providerTypes.ts:69](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/models/providerTypes.ts#L69) ___ @@ -360,7 +360,7 @@ Similar to [partial](https://www.typescriptlang.org/docs/handbook/utility-types. #### Defined in -[src/models/utilityTypes.ts:7](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/models/utilityTypes.ts#L7) +[src/models/utilityTypes.ts:7](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/models/utilityTypes.ts#L7) ___ @@ -387,7 +387,7 @@ ___ #### Defined in -[src/models/contractContextTypes.ts:4](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/models/contractContextTypes.ts#L4) +[src/models/contractContextTypes.ts:4](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/models/contractContextTypes.ts#L4) ___ @@ -405,7 +405,7 @@ ___ #### Defined in -[src/models/contractContextTypes.ts:13](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/models/contractContextTypes.ts#L13) +[src/models/contractContextTypes.ts:13](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/models/contractContextTypes.ts#L13) ___ @@ -421,7 +421,7 @@ ___ #### Defined in -[src/models/contractContextTypes.ts:24](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/models/contractContextTypes.ts#L24) +[src/models/contractContextTypes.ts:24](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/models/contractContextTypes.ts#L24) ___ @@ -438,7 +438,7 @@ ___ #### Defined in -[src/models/contractContextTypes.ts:28](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/models/contractContextTypes.ts#L28) +[src/models/contractContextTypes.ts:28](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/models/contractContextTypes.ts#L28) ___ @@ -454,7 +454,7 @@ ___ #### Defined in -[src/models/contractContextTypes.ts:37](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/models/contractContextTypes.ts#L37) +[src/models/contractContextTypes.ts:37](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/models/contractContextTypes.ts#L37) ___ @@ -470,7 +470,7 @@ ___ #### Defined in -[src/models/contractContextTypes.ts:42](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/models/contractContextTypes.ts#L42) +[src/models/contractContextTypes.ts:42](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/models/contractContextTypes.ts#L42) ___ @@ -494,7 +494,7 @@ ___ #### Defined in -[src/models/contractContextTypes.ts:50](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/models/contractContextTypes.ts#L50) +[src/models/contractContextTypes.ts:50](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/models/contractContextTypes.ts#L50) ___ @@ -514,7 +514,7 @@ Describes the sctructure of each contract in hardhat_contracts.json #### Defined in -[src/models/contractTypes.ts:5](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/models/contractTypes.ts#L5) +[src/models/contractTypes.ts:5](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/models/contractTypes.ts#L5) ___ @@ -533,7 +533,7 @@ Contracts by contract name #### Defined in -[src/models/contractTypes.ts:16](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/models/contractTypes.ts#L16) +[src/models/contractTypes.ts:16](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/models/contractTypes.ts#L16) ___ @@ -545,7 +545,7 @@ ___ Options for hooks that describe the behviour of updates. By default, depending on the hook, it will update every block. -##### Notes +##### ✏️ Notes The following options are available: - interval: interval in blocknumber to update in (default 1) see {@link TUpdateOptions.blockNumberInterval} - polling: in ms, should be over 10000ms. This is set by {@link TUpdateOptions.query.refetchInterval} @@ -563,7 +563,7 @@ The following options are available: #### Defined in -[src/models/hookOptions.ts:33](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/models/hookOptions.ts#L33) +[src/models/hookOptions.ts:33](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/models/hookOptions.ts#L33) ___ @@ -576,7 +576,7 @@ Ethers Provider options. By default, the context provider is used by the hook. - pass in an [TEthersAdaptor](Models.md#tethersadaptor) to override the provider - give the alternateContextKey for a secondary context provider. -##### Notes +##### ✏️ Notes Adaptor - To create a adaptor from a provider/signer see {@link useGetEthersAdaptorFromSignerOrProvider} - You need to set adaptorEnabled to true @@ -594,7 +594,7 @@ Alternate Context Key #### Defined in -[src/models/hookOptions.ts:76](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/models/hookOptions.ts#L76) +[src/models/hookOptions.ts:76](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/models/hookOptions.ts#L76) ___ @@ -619,7 +619,7 @@ Essentially a object that allows interaction with the network: #### Defined in -[src/models/ethersAppContextTypes.ts:49](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/models/ethersAppContextTypes.ts#L49) +[src/models/ethersAppContextTypes.ts:49](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/models/ethersAppContextTypes.ts#L49) ## Functions @@ -635,7 +635,7 @@ An helper to create the default override settings for hooks #### Defined in -[src/models/hookOptions.ts:96](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/models/hookOptions.ts#L96) +[src/models/hookOptions.ts:96](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/models/hookOptions.ts#L96) ___ @@ -651,4 +651,4 @@ A helper to create default update options for hooks #### Defined in -[src/models/hookOptions.ts:108](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/models/hookOptions.ts#L108) +[src/models/hookOptions.ts:108](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/models/hookOptions.ts#L108) diff --git a/docs/api-typedocs/modules/TestUtils.md b/docs/api-typedocs/modules/TestUtils.md index ddab22a0..0b33101c 100644 --- a/docs/api-typedocs/modules/TestUtils.md +++ b/docs/api-typedocs/modules/TestUtils.md @@ -44,7 +44,7 @@ Utilities to write tests with ethers, waffle and react hooks #### Defined in -[src/helpers/test-utils/constants/testConstants.ts:3](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/helpers/test-utils/constants/testConstants.ts#L3) +[src/helpers/test-utils/constants/testConstants.ts:3](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/helpers/test-utils/constants/testConstants.ts#L3) ___ @@ -54,7 +54,7 @@ ___ #### Defined in -[src/helpers/test-utils/constants/testConstants.ts:5](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/helpers/test-utils/constants/testConstants.ts#L5) +[src/helpers/test-utils/constants/testConstants.ts:5](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/helpers/test-utils/constants/testConstants.ts#L5) ___ @@ -64,7 +64,7 @@ ___ #### Defined in -[src/helpers/test-utils/constants/testConstants.ts:7](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/helpers/test-utils/constants/testConstants.ts#L7) +[src/helpers/test-utils/constants/testConstants.ts:7](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/helpers/test-utils/constants/testConstants.ts#L7) ___ @@ -80,7 +80,7 @@ This is a wrapper for tests #### Defined in -[src/helpers/test-utils/wrapper/TestAppWrapper.tsx:37](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/helpers/test-utils/wrapper/TestAppWrapper.tsx#L37) +[src/helpers/test-utils/wrapper/TestAppWrapper.tsx:37](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/helpers/test-utils/wrapper/TestAppWrapper.tsx#L37) ## Functions @@ -100,7 +100,7 @@ This is a wrapper for tests #### Defined in -[src/helpers/test-utils/eth/hardhatActions.ts:3](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/helpers/test-utils/eth/hardhatActions.ts#L3) +[src/helpers/test-utils/eth/hardhatActions.ts:3](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/helpers/test-utils/eth/hardhatActions.ts#L3) ___ @@ -120,7 +120,7 @@ ___ #### Defined in -[src/helpers/test-utils/functions/conversions.ts:3](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/helpers/test-utils/functions/conversions.ts#L3) +[src/helpers/test-utils/functions/conversions.ts:3](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/helpers/test-utils/functions/conversions.ts#L3) ___ @@ -140,7 +140,7 @@ ___ #### Defined in -[src/helpers/test-utils/functions/conversions.ts:7](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/helpers/test-utils/functions/conversions.ts#L7) +[src/helpers/test-utils/functions/conversions.ts:7](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/helpers/test-utils/functions/conversions.ts#L7) ___ @@ -160,7 +160,7 @@ ___ #### Defined in -[src/helpers/test-utils/functions/expect.ts:4](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/helpers/test-utils/functions/expect.ts#L4) +[src/helpers/test-utils/functions/expect.ts:4](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/helpers/test-utils/functions/expect.ts#L4) ___ @@ -174,7 +174,7 @@ ___ #### Defined in -[src/helpers/test-utils/wrapper/getMockProvider.ts:6](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/helpers/test-utils/wrapper/getMockProvider.ts#L6) +[src/helpers/test-utils/wrapper/getMockProvider.ts:6](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/helpers/test-utils/wrapper/getMockProvider.ts#L6) ___ @@ -188,7 +188,7 @@ ___ #### Defined in -[src/helpers/test-utils/wrapper/hardhatTestHelpers.ts:4](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/helpers/test-utils/wrapper/hardhatTestHelpers.ts#L4) +[src/helpers/test-utils/wrapper/hardhatTestHelpers.ts:4](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/helpers/test-utils/wrapper/hardhatTestHelpers.ts#L4) ___ @@ -202,7 +202,7 @@ ___ #### Defined in -[src/helpers/test-utils/wrapper/hardhatTestHelpers.ts:12](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/helpers/test-utils/wrapper/hardhatTestHelpers.ts#L12) +[src/helpers/test-utils/wrapper/hardhatTestHelpers.ts:12](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/helpers/test-utils/wrapper/hardhatTestHelpers.ts#L12) ___ @@ -234,7 +234,7 @@ Created a test hook with a Web3Wrapper #### Defined in -[src/helpers/test-utils/wrapper/testWrapper.tsx:28](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/helpers/test-utils/wrapper/testWrapper.tsx#L28) +[src/helpers/test-utils/wrapper/testWrapper.tsx:28](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/helpers/test-utils/wrapper/testWrapper.tsx#L28) ___ @@ -254,7 +254,7 @@ ___ #### Defined in -[src/helpers/test-utils/wrapper/wrapperHelpers.ts:6](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/helpers/test-utils/wrapper/wrapperHelpers.ts#L6) +[src/helpers/test-utils/wrapper/wrapperHelpers.ts:6](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/helpers/test-utils/wrapper/wrapperHelpers.ts#L6) ___ @@ -274,7 +274,7 @@ ___ #### Defined in -[src/helpers/test-utils/wrapper/wrapperHelpers.ts:15](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/helpers/test-utils/wrapper/wrapperHelpers.ts#L15) +[src/helpers/test-utils/wrapper/wrapperHelpers.ts:15](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/helpers/test-utils/wrapper/wrapperHelpers.ts#L15) ___ @@ -295,7 +295,7 @@ ___ #### Defined in -[src/helpers/test-utils/wrapper/wrapperHelpers.ts:26](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/helpers/test-utils/wrapper/wrapperHelpers.ts#L26) +[src/helpers/test-utils/wrapper/wrapperHelpers.ts:26](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/helpers/test-utils/wrapper/wrapperHelpers.ts#L26) ___ @@ -316,7 +316,7 @@ ___ #### Defined in -[src/helpers/test-utils/wrapper/wrapperHelpers.ts:36](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/helpers/test-utils/wrapper/wrapperHelpers.ts#L36) +[src/helpers/test-utils/wrapper/wrapperHelpers.ts:36](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/helpers/test-utils/wrapper/wrapperHelpers.ts#L36) ## Type aliases @@ -332,4 +332,4 @@ ___ #### Defined in -[src/helpers/test-utils/wrapper/testWrapper.tsx:14](https://github.com/scaffold-eth/eth-hooks/blob/c01ffd0/src/helpers/test-utils/wrapper/testWrapper.tsx#L14) +[src/helpers/test-utils/wrapper/testWrapper.tsx:14](https://github.com/scaffold-eth/eth-hooks/blob/97c8775/src/helpers/test-utils/wrapper/testWrapper.tsx#L14) diff --git a/src/context/ethers/BlockNumberContext.tsx b/src/context/ethers/BlockNumberContext.tsx index 6aa96c56..16dbaf94 100644 --- a/src/context/ethers/BlockNumberContext.tsx +++ b/src/context/ethers/BlockNumberContext.tsx @@ -48,12 +48,12 @@ const reducer = (state: State = {}, payload: Payload): State => { * A hook that gets you the current blocknumber via react context * - can be shared by your whole app. * - * ##### Use + * ##### ❔Use * Make sure to wrap your main app with the {@link EthersAppContext}. * - See [scaffold-eth-typescript example](https://github.com/scaffold-eth/scaffold-eth-typescript/blob/0225179a2a8bb7b3a255d6eff4802b47d72809dd/packages/vite-app-ts/src/components/routes/App.tsx#L38) * * - * ##### Notes + * ##### ✏️ Notes * - this extensively used by eth-hooks to trigger hooks when a new block arrives * - uses the current provider {@link ethersProvider} from {@link useEthersContext} * diff --git a/src/context/ethers/EthersAppContext.tsx b/src/context/ethers/EthersAppContext.tsx index 4d13193f..a15aea1b 100644 --- a/src/context/ethers/EthersAppContext.tsx +++ b/src/context/ethers/EthersAppContext.tsx @@ -19,14 +19,14 @@ import { IEthersContext } from '~~/models/ethersAppContextTypes'; * This Hook provides you with access to the current Ethers Provider Context. * This provider would be the one selected by using {@link EthersModalConnector} and Web3Modal * - * ##### Features + * ##### ✨ Features * Gives you access to consistent interface to get the current provider information {@link EthersModalConnector} * - ethers compatable provider {@link TEthersProvider} * - a callback to change the current account (signer) * - the current account, chainId and signer * - callbacks to open the web3Modal, logout or change theme * - * ##### Notes + * ##### ✏️ Notes * - currently providerKey isnt being used * * @category EthersContext diff --git a/src/context/ethers/connectors/EthersModalConnector.ts b/src/context/ethers/connectors/EthersModalConnector.ts index 21f7f220..0854e685 100644 --- a/src/context/ethers/connectors/EthersModalConnector.ts +++ b/src/context/ethers/connectors/EthersModalConnector.ts @@ -49,11 +49,11 @@ export type TEthersModalConnector = ICommonModalConnector & AbstractConnector; * This is a connector for [web3-react](https://github.com/NoahZinsmeister/web3-react) that allows it to interface with [web3Modal](https://github.com/Web3Modal/web3modal). * The provider selected by user via web3modal is interfaced to the web3-react context. * - * ##### Features + * ##### ✨ Features * - This connector used with {@link useEthersContext} allows the app and all the hooks to effortlessly access the current network, provider, signer, address information {@link IEthersContext} * - The connector centralizes and takes care of management of the web3 interaction and provides a consistent exprience for your app. * - * ##### Notes + * ##### ✏️ Notes * - inherits from web3-react class AbstractConnector * * @category EthersContext @@ -161,13 +161,13 @@ export class EthersModalConnector extends AbstractConnector implements ICommonMo * #### Summary * Inherits from AbstractConnector. This activates web3Modal and opens the modal. * - * ##### Notes + * ##### ✏️ Notes * Once the user selects a provider * - this will activate the provider and attach the appropriate event listeners. * - get the account and signer * - gets the ethers compatable provider * - * ##### Errors + * ##### ⚠️ Errors * - {@link UserClosedModalError} * - {@link CouldNotActivateError} * @returns diff --git a/src/context/ethers/connectors/StaticJsonRpcProviderConnector.ts b/src/context/ethers/connectors/StaticJsonRpcProviderConnector.ts index bb68ea9f..dd84298c 100644 --- a/src/context/ethers/connectors/StaticJsonRpcProviderConnector.ts +++ b/src/context/ethers/connectors/StaticJsonRpcProviderConnector.ts @@ -18,7 +18,7 @@ export interface IStaticJsonRpcProviderConnectorOptions extends IAbstractConnect * A connector that can be used by apps to connect to a StaticJsonRpcProvider * - For example you can use this to connect to a localhost provider * - * ##### Notes + * ##### ✏️ Notes * See scaffold-eth-typescript for an example that uses it to connect to a localhost burner wallet. * - [scaffold-eth-typescript example](https://github.com/scaffold-eth/scaffold-eth-typescript/blob/0225179a2a8bb7b3a255d6eff4802b47d72809dd/packages/vite-app-ts/src/config/web3ModalConfig.ts#L86) * diff --git a/src/hooks/dapps/useDexEthPrice.ts b/src/hooks/dapps/useDexEthPrice.ts index 0d64aa62..bcdc3bb6 100644 --- a/src/hooks/dapps/useDexEthPrice.ts +++ b/src/hooks/dapps/useDexEthPrice.ts @@ -14,7 +14,7 @@ const queryKey: TRequiredKeys = { namespace: keyNamespace.signer, key: 'useDexEt * #### Summary * Get the Exchange price of ETH/USD (extrapolated from WETH/DAI) from uniswap * - * ##### Notes + * ##### ✏️ Notes * - uses useOnRepetition, does not use context * * @category Hooks diff --git a/src/hooks/dapps/useDexTokenList.ts b/src/hooks/dapps/useDexTokenList.ts index 229bae70..992c2cfa 100644 --- a/src/hooks/dapps/useDexTokenList.ts +++ b/src/hooks/dapps/useDexTokenList.ts @@ -15,7 +15,7 @@ const queryKey: TRequiredKeys = { namespace: keyNamespace.signer, key: 'useDexTo * #### Summary * Gets a tokenlist from uniswap ipfs tokenlist * - * #### Note + * ##### ✏️ Notes * - you can also point it to another URI * * @category Hooks diff --git a/src/hooks/erc/useTokenBalance.ts b/src/hooks/erc/useTokenBalance.ts index 17974571..dd63e487 100644 --- a/src/hooks/erc/useTokenBalance.ts +++ b/src/hooks/erc/useTokenBalance.ts @@ -20,7 +20,7 @@ type ERC20 = { * Get the balance of an ERC20 token in an address * - uses the ethers.Contract object's provider to access the network * - * ##### Notes + * ##### ✏️ Notes * - uses useOnRepetition * * @category Hooks diff --git a/src/hooks/useBalance.ts b/src/hooks/useBalance.ts index 8337cb25..d5f9e106 100644 --- a/src/hooks/useBalance.ts +++ b/src/hooks/useBalance.ts @@ -21,7 +21,7 @@ type TUseBalanceResult> = GAddress exten * #### Summary * Gets your balance in ETH for the given address. * - * ##### Notes + * ##### ✏️ Notes * - updates triggered by {@link BlockNumberContext} * - uses the current provider {@link provider} from {@link useEthersContext} * diff --git a/src/hooks/useBlockNumber.ts b/src/hooks/useBlockNumber.ts index 0fdc133a..016e187f 100644 --- a/src/hooks/useBlockNumber.ts +++ b/src/hooks/useBlockNumber.ts @@ -7,7 +7,7 @@ import { TEthersProvider } from '~~/models'; * #### Summary * Get the current block number of the network. ✋🏽 @deprecated * - * ##### Notes + * ##### ✏️ Notes * - ✋🏽 For app wide block number access use {@link useBlockNumberContext} instead. See {@link BlockNumberContext} for more details, you get this as part of {@link EthersAppContext} * - uses the current provided block number * diff --git a/src/hooks/useBurnerSigner.ts b/src/hooks/useBurnerSigner.ts index 097a5bb7..1b2cc5dd 100644 --- a/src/hooks/useBurnerSigner.ts +++ b/src/hooks/useBurnerSigner.ts @@ -46,7 +46,7 @@ const loadBurnerKeyFromStorage = (): string | null => { * #### Summary * Return type of useBurnerSigner: * - * ##### Notes + * ##### ✏️ Notes * - provides signer * - methods of interacting with burner signer * - methods to save and loadd signer from local storage diff --git a/src/hooks/useContractExistsAtAddress.ts b/src/hooks/useContractExistsAtAddress.ts index 598df7f0..95fd8a79 100644 --- a/src/hooks/useContractExistsAtAddress.ts +++ b/src/hooks/useContractExistsAtAddress.ts @@ -13,7 +13,7 @@ const queryKey: TRequiredKeys = { namespace: keyNamespace.contracts, key: 'useCo * #### Summary * Checks whether a contract exists on the blockchain * - * ##### Notes + * ##### ✏️ Notes * - uses the ethers.Contract object's provider to access the network * - checks the contract address to see if the contract is deployed * diff --git a/src/hooks/useContractLoader.ts b/src/hooks/useContractLoader.ts index e8eb25ab..53f8a92f 100644 --- a/src/hooks/useContractLoader.ts +++ b/src/hooks/useContractLoader.ts @@ -84,7 +84,7 @@ export const parseContractsInJson = ( * Loads your contracts and returns them. ✋🏽 @deprecated * Gives options to read values from contracts or write transactions into them. * - * ##### Notes + * ##### ✏️ Notes * - ✋🏽 For easy app wide contract access use {@link AppContractContex} created by {@link contractsContextFactory}. See {@link contractsContextFactory} for more details. * * A optional providerOrSigner is needed to initalize the contract class diff --git a/src/hooks/useContractReader.ts b/src/hooks/useContractReader.ts index 55c41358..05ea1801 100644 --- a/src/hooks/useContractReader.ts +++ b/src/hooks/useContractReader.ts @@ -15,7 +15,7 @@ const queryKey = { namespace: keyNamespace.contracts, key: 'useContractReader' } * #### Summary * Enables you to call a contract function with arguments and receive the output. You can use this to easily track of contract outputs in react states * - * ##### Notes + * ##### ✏️ Notes * - uses the ethers.Contract object's provider to access the network * - formatter is a function that can change the format of the output * @param contract @@ -93,7 +93,7 @@ export const useContractReader = < * #### Summary * Enables you to call a contract function with arguments and receive the output. You can use this to easily track of contract outputs in react states * - * ##### Notes + * ##### ✏️ Notes * - uses the ethers.Contract object's provider to access the network * - formatter is a function that can change the format of the output * diff --git a/src/hooks/useEventListener.ts b/src/hooks/useEventListener.ts index ce759746..ca35a33b 100644 --- a/src/hooks/useEventListener.ts +++ b/src/hooks/useEventListener.ts @@ -12,7 +12,7 @@ const queryKey: TRequiredKeys = { namespace: keyNamespace.contracts, key: 'useEv * #### Summary * Tracks the events of associated with a contract * - * ##### Notes + * ##### ✏️ Notes * - updates triggered through ethers event listener * - uses the current provider {@link ethersProvider} from {@link useEthersContext} * diff --git a/src/hooks/useGasPrice.ts b/src/hooks/useGasPrice.ts index 2e75697b..d7c01827 100644 --- a/src/hooks/useGasPrice.ts +++ b/src/hooks/useGasPrice.ts @@ -34,7 +34,7 @@ export type TGasStationSpeed = 'fast' | 'fastest' | 'safeLow' | 'average'; * - uses ethers.estimateGas other networks * - can use currentNetworkInfo {@link TNetworkInfo.gasPrice} gasPrice as fallback * - * ##### Notes + * ##### ✏️ Notes * - if the gas price is unknown it returns undefined * - updates triggered by {@link BlockNumberContext} * - uses the current provider {@link ethersProvider} from {@link useEthersContext} diff --git a/src/hooks/useNonce.ts b/src/hooks/useNonce.ts index 4c34ccb5..68a71d4b 100644 --- a/src/hooks/useNonce.ts +++ b/src/hooks/useNonce.ts @@ -21,7 +21,7 @@ const queryKey: TRequiredKeys = { * #### Summary * Get the current nonce for the address provided * - * ##### Notes + * ##### ✏️ Notes * - updates triggered by {@link BlockNumberContext} * - uses the current provider {@link ethersProvider} from {@link useEthersContext} * diff --git a/src/hooks/useTimestamp.ts b/src/hooks/useTimestamp.ts index 40c3829d..efec1863 100644 --- a/src/hooks/useTimestamp.ts +++ b/src/hooks/useTimestamp.ts @@ -18,7 +18,7 @@ const queryKey: TRequiredKeys = { namespace: keyNamespace.signer, key: 'useTimes * #### Summary * Get the current timestamp from the latest block * - * ##### Notes + * ##### ✏️ Notes * - updates triggered by {@link BlockNumberContext} * - uses the current provider {@link ethersProvider} from {@link useEthersContext} * diff --git a/src/models/ethersAppContextTypes.ts b/src/models/ethersAppContextTypes.ts index acb7a86e..217a609d 100644 --- a/src/models/ethersAppContextTypes.ts +++ b/src/models/ethersAppContextTypes.ts @@ -8,7 +8,7 @@ import { TEthersProvider, TEthersSigner } from '~~/models'; * #### Summary * A callback type that returns a EthersModalConnector * - * ##### Notes + * ##### ✏️ Notes * - can be used by components that need to give a connector to {@link IEthersContext.openModal} * - id is the identifier of the provider: [See docs](https://github.com/Web3Modal/web3modal#connect-to-specific-provider) * diff --git a/src/models/hookOptions.ts b/src/models/hookOptions.ts index 32d35da5..0acdd2fe 100644 --- a/src/models/hookOptions.ts +++ b/src/models/hookOptions.ts @@ -25,7 +25,7 @@ export const const_blockNumberIntervalLong: DeepPartial = { bloc * Options for hooks that describe the behviour of updates. * By default, depending on the hook, it will update every block. * - * ##### Notes + * ##### ✏️ Notes * The following options are available: * - interval: interval in blocknumber to update in (default 1) see {@link TUpdateOptions.blockNumberInterval} * - polling: in ms, should be over 10000ms. This is set by {@link TUpdateOptions.query.refetchInterval} @@ -65,7 +65,7 @@ export type TUpdateOptions = { * - pass in an {@link TEthersAdaptor} to override the provider * - give the alternateContextKey for a secondary context provider. * - * ##### Notes + * ##### ✏️ Notes * Adaptor * - To create a adaptor from a provider/signer see {@link useGetEthersAdaptorFromSignerOrProvider} * - You need to set adaptorEnabled to true diff --git a/src/models/providerTypes.ts b/src/models/providerTypes.ts index 34144f64..07b6c61f 100644 --- a/src/models/providerTypes.ts +++ b/src/models/providerTypes.ts @@ -11,7 +11,7 @@ import { Result } from 'ethers/lib/utils'; * #### Summary * A union of various ethers providers for ease of use and maximum flexiblity * - * ##### Notes + * ##### ✏️ Notes * Used by eth-hooks, eth-components and scaffold-eth-typescript * * @category Models From 31bf7b18762fe1b7a6e7a6b3b347ed74560dda03 Mon Sep 17 00:00:00 2001 From: Shravan Sunder Date: Sat, 15 Jan 2022 11:45:07 -0500 Subject: [PATCH 14/21] #125 improved typing and updated to #125. waiting for eth-sdk to update to v7 --- .../app-contracts/contractConnectors.ts | 70 ++------ .../app-contracts/contractsContextFactory.tsx | 154 ++++++++++++++---- src/functions/index.ts | 2 +- src/functions/sortContracts.tsx | 87 +++++----- src/models/contractContextTypes.ts | 69 ++++---- 5 files changed, 219 insertions(+), 163 deletions(-) diff --git a/src/context/app-contracts/contractConnectors.ts b/src/context/app-contracts/contractConnectors.ts index 1d0459f1..1f853151 100644 --- a/src/context/app-contracts/contractConnectors.ts +++ b/src/context/app-contracts/contractConnectors.ts @@ -1,7 +1,6 @@ -import { BaseContract, ethers, utils } from 'ethers'; +import { BaseContract, ethers } from 'ethers'; -import { isValidEthersAdaptor } from '~~/functions'; -import { TConnectorConnectorBase, TContractConnector, TEthersAdaptor } from '~~/models'; +import { TConnectorConnectorBase, TContractConnector } from '~~/models'; import { TBasicContractDataRecord, TExternalContractsAddressMap, @@ -41,15 +40,11 @@ const extractExternalContracts = (configJson: TExternalContractsAddressMap): TBa return contractData; }; -export const createConnectorForHardhatContract = < - GContractNames extends string, - GBaseContract extends BaseContract, - GContractInterface extends ethers.utils.Interface ->( +export const createConnectorForHardhatContract = ( contractName: GContractNames, - typechainFactory: TConnectorConnectorBase, + typechainFactory: TConnectorConnectorBase, deployedHardhatContractJson: TDeployedHardhatContractsJson -): TContractConnector => { +): TContractConnector => { const info = extractHardhatContracts(deployedHardhatContractJson)[contractName]; if (info == null) { @@ -61,7 +56,7 @@ export const createConnectorForHardhatContract = < return { contractName, connect: typechainFactory.connect, - createInterface: typechainFactory.createInterface, + // createInterface: typechainFactory.createInterface, abi: (info?.abi ?? typechainFactory.abi ?? []) as Record[], config: { [info.chainId]: { @@ -71,15 +66,11 @@ export const createConnectorForHardhatContract = < }; }; -export const createConnectorForExternalContract = < - GContractNames extends string, - GBaseContract extends BaseContract, - GContractInterface extends ethers.utils.Interface ->( +export const createConnectorForExternalContract = ( contractName: GContractNames, - typechainFactory: TConnectorConnectorBase, + typechainFactory: TConnectorConnectorBase, deployedContractJson: TExternalContractsAddressMap -): TContractConnector => { +): TContractConnector => { const info = extractExternalContracts(deployedContractJson)[contractName]; if (info == null) { @@ -91,7 +82,7 @@ export const createConnectorForExternalContract = < return { contractName, connect: typechainFactory.connect, - createInterface: typechainFactory.createInterface, + // : typechainFactory.createInterface, abi: (info?.abi ?? typechainFactory.abi ?? []) as Record[], config: { [info.chainId]: { @@ -105,52 +96,13 @@ export const createConnectorForExternalAbi = ( contractName: GContractNames, config: { [key in number]: { address: string } }, abi: Record[] -): TContractConnector => { +): TContractConnector => { return { contractName, connect: (address: string, signerOrProvider: ethers.Signer | ethers.providers.Provider): BaseContract => { return new BaseContract(address, abi, signerOrProvider); }, - createInterface: (): ethers.utils.Interface => new utils.Interface(abi), abi: abi, config: config, }; }; - -export const connectToContractWithAdaptor = < - GContractNames extends string, - GContract extends BaseContract, - GContractInterface extends ethers.utils.Interface ->( - connector: TContractConnector, - adaptor: TEthersAdaptor -): GContract | undefined => { - if (adaptor == null || !isValidEthersAdaptor(adaptor)) { - console.warn('No valid ethers adaptor provided. Skipping contract connection'); - return undefined; - } - - const { signer, provider } = adaptor; - const signerOrProvider = signer ?? provider; - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - const chainId = adaptor.chainId!; - const contractAddress = connector?.config?.[chainId]?.address; - if (contractAddress != null && signerOrProvider != null) { - const contract = connector.connect(connector.config[chainId].address, signerOrProvider); - if (contract != null) { - return contract; - } - } - - // error handling - if (connector.config[chainId] != null) { - console.warn('ContractConnector requires signer with the same chainId to connect contract'); - } - console.log( - `Couldn't connect to contract ${connector?.contractName}: signer chainId: ${chainId}, config: ${JSON.stringify( - connector?.config - )}.` - ); - console.log('🙅🏽‍♂️ Please make sure the correct network is connected and the contract is deployed.'); - return undefined; -}; diff --git a/src/context/app-contracts/contractsContextFactory.tsx b/src/context/app-contracts/contractsContextFactory.tsx index 2603f7a9..21543125 100644 --- a/src/context/app-contracts/contractsContextFactory.tsx +++ b/src/context/app-contracts/contractsContextFactory.tsx @@ -13,11 +13,18 @@ import React, { import { useQueryClient } from 'react-query'; import invariant from 'ts-invariant'; -import { connectToContractWithAdaptor, useEthersContext } from '~~/context'; -import { invalidateCache, isValidEthersAdaptor, sortContractsByChainId, sortContractsByName } from '~~/functions'; -import { TTypedContract, TEthersAdaptor, TConnectorList } from '~~/models'; +import { useEthersContext } from '~~/context'; +import { invalidateCache, isValidEthersAdaptor } from '~~/functions'; +import { TEthersAdaptor } from '~~/models'; import { keyNamespace } from '~~/models/constants'; -import { TAppContractsContext, defaultAppContractsContext, TContractsByName } from '~~/models/contractContextTypes'; +import { + TAppContractsContext, + TBaseContractExtended, + TConnectorList, + TContractConnector, + TContractsByChainId, + TContractsByName, +} from '~~/models/contractContextTypes'; export type TContractsContextProps = { ethersContextKey?: string | undefined; @@ -78,31 +85,41 @@ export type TContractsContextActions + GAppConnectorList extends TConnectorList>, + GContractsTypes extends ReturnType]['connect']> >( loadAppContractConnectors: () => GAppConnectorList | undefined ): { ContractsAppContext: FC>; useAppContractsActions: () => TContractsContextActions | undefined; - useAppContractsContext: ( + useAppContractsContext: ( contractName: GContractNames, chainId: number | undefined ) => GContract | undefined; useLoadAppContracts: () => void; useConnectAppContracts: (adaptor: TEthersAdaptor | undefined) => void; } => { + type GAppContractsContext = TAppContractsContext; + /* *************** ******** ************************************ */ /* *************** Contract Helpers Functions ****************** */ + const defaultAppContractsContext = (): GAppContractsContext => { + return { + contractConnectors: {}, + contractsByName: {}, + contractsByChainId: {}, + } as GAppContractsContext; + }; + /** * Create context state * @param appContractConnectorList * @returns * @internal */ - const initalizeState = (appContractConnectorList: GAppConnectorList): TAppContractsContext => { - const state = defaultAppContractsContext(); - state.contractConnectors = appContractConnectorList as unknown as TConnectorList; + const initalizeState = (appContractConnectorList: GAppConnectorList): GAppContractsContext => { + const state = defaultAppContractsContext(); + state.contractConnectors = appContractConnectorList as unknown as GAppContractsContext['contractConnectors']; return state; }; @@ -112,8 +129,8 @@ export const contractsContextFactory = < * @returns * @internal */ - const cloneContextState = (state: TAppContractsContext): TAppContractsContext => { - const newState = defaultAppContractsContext(); + const cloneContextState = (state: GAppContractsContext): GAppContractsContext => { + const newState = defaultAppContractsContext(); newState.contractConnectors = { ...state.contractConnectors }; newState.contractsByName = { ...state.contractsByName }; newState.contractsByChainId = { ...state.contractsByChainId }; @@ -121,10 +138,52 @@ export const contractsContextFactory = < return newState; }; + const sortContractsByChainId = ( + contractsByName: TContractsByName + ): TContractsByChainId => { + let contractsByChainId: TContractsByChainId = {}; + + const names: GContractNames[] = Object.keys(contractsByName) as GContractNames[]; + names.forEach((name) => { + const chainIds = Object.keys(contractsByName[name]).map(Number); + chainIds.forEach((chainId) => { + const data = { + [chainId]: { [name]: contractsByName[name][chainId] }, + } as TContractsByName; + const temp = merge(contractsByChainId, data); + contractsByChainId = temp as TContractsByChainId; + }); + }); + return contractsByChainId; + }; + + const sortContractsByName = ( + contractsByChainId: TContractsByChainId + ): TContractsByName => { + let contractsByName: TContractsByName = {} as TContractsByName< + GContractNames, + GContractsTypes + >; + + const chainIds = Object.keys(contractsByChainId).map(Number); + chainIds.forEach((chainId) => { + const names = Object.keys(contractsByChainId[chainId]) as GContractNames[]; + names.forEach((name) => { + const data = { + [name]: { [chainId]: contractsByChainId[chainId][name] }, + }; + const temp = merge(contractsByName, data); + contractsByName = temp as TContractsByName; + }); + }); + + return contractsByName; + }; + const removeInvalidContracts = ( - state: TAppContractsContext, + state: GAppContractsContext, ethersAdaptor: TEthersAdaptor | undefined - ): TAppContractsContext => { + ): GAppContractsContext => { if (ethersAdaptor?.chainId != null) { const newState = cloneContextState(state); const chainId = ethersAdaptor.chainId; @@ -138,6 +197,41 @@ export const contractsContextFactory = < /* *************** ******** ****************************************** */ /* *************** Contract Action Helper Functions ****************** */ + + const connectToContractWithAdaptor = ( + connector: TContractConnector, + adaptor: TEthersAdaptor + ): GContractsTypes | undefined => { + if (adaptor == null || !isValidEthersAdaptor(adaptor)) { + console.warn('No valid ethers adaptor provided. Skipping contract connection'); + return undefined; + } + + const { signer, provider } = adaptor; + const signerOrProvider = signer ?? provider; + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + const chainId = adaptor.chainId!; + const contractAddress = connector?.config?.[chainId]?.address; + if (contractAddress != null && signerOrProvider != null) { + const contract = connector.connect(connector.config[chainId].address, signerOrProvider); + if (contract != null) { + return contract; + } + } + + // error handling + if (connector.config[chainId] != null) { + console.warn('ContractConnector requires signer with the same chainId to connect contract'); + } + console.log( + `Couldn't connect to contract ${connector?.contractName}: signer chainId: ${chainId}, config: ${JSON.stringify( + connector?.config + )}.` + ); + console.log('🙅🏽‍♂️ Please make sure the correct network is connected and the contract is deployed.'); + return undefined; + }; + /** * Internal function to connect to all contracts * @param payload @@ -145,9 +239,9 @@ export const contractsContextFactory = < * @internal */ const connectToAllContracts = ( - state: TAppContractsContext, + state: GAppContractsContext, ethersAdaptor: TEthersAdaptor | undefined - ): TAppContractsContext => { + ): GAppContractsContext => { if (ethersAdaptor == null || !isValidEthersAdaptor(ethersAdaptor)) { invariant.log('connectToAllContracts: Invalid ethers adaptor'); return removeInvalidContracts(state, ethersAdaptor); @@ -160,8 +254,11 @@ export const contractsContextFactory = < const connector = newState.contractConnectors[contractName]; if (chainId && connector.config[chainId] != null && providerOrSigner != null) { const contract = connectToContractWithAdaptor(connector, ethersAdaptor); - const data = { [contractName]: { [chainId]: contract } } as TContractsByName; - newState.contractsByName = merge(newState.contractsByName, data) as TContractsByName; + const data = { [contractName]: { [chainId]: contract } } as TContractsByName; + newState.contractsByName = merge(newState.contractsByName, data) as TContractsByName< + GContractNames, + GContractsTypes + >; } } newState.contractsByChainId = sortContractsByChainId(newState.contractsByName); @@ -176,10 +273,10 @@ export const contractsContextFactory = < * @internal */ const connectToContract = ( - state: TAppContractsContext, + state: GAppContractsContext, contractName: GContractNames, ethersAdaptor: TEthersAdaptor | undefined - ): TAppContractsContext => { + ): GAppContractsContext => { if (ethersAdaptor == null || !isValidEthersAdaptor(ethersAdaptor)) { invariant.log('connectToAllContracts: Invalid ethers adaptor'); return removeInvalidContracts(state, ethersAdaptor); @@ -192,7 +289,8 @@ export const contractsContextFactory = < if (chainId && contractConnector.config[chainId] != null) { const contract = connectToContractWithAdaptor(contractConnector, ethersAdaptor); newState.contractsByName[contractConnector.contractName] = {}; - newState.contractsByName[contractConnector.contractName][chainId] = contract; + const temp = newState.contractsByName[contractConnector.contractName]; + temp[chainId] = contract; newState.contractsByChainId = sortContractsByChainId(newState.contractsByName); } return newState; @@ -205,9 +303,9 @@ export const contractsContextFactory = < * @returns */ const reducer = ( - state: TAppContractsContext, + state: GAppContractsContext, action: TActions - ): TAppContractsContext => { + ): GAppContractsContext => { switch (action.type) { case 'CONNECT_TO_CONTRACT': { return connectToContract(state, action.payload.contractName, action.payload.ethersAdaptor); @@ -217,8 +315,8 @@ export const contractsContextFactory = < } case 'ADD_CONTRACT_CONNECTORS': { const newState = initalizeState(action.payload.appContractConnectorList); - // @ts-ignore - const newValue = merge(state, newState) as TAppContractsContext; + // @ts-expect-error + const newValue = merge(state, newState) as GAppContractsContext; return newValue; } case 'SET_CONTRACT_CONNECTORS': { @@ -246,8 +344,8 @@ export const contractsContextFactory = < * * @internal */ - const ContractsStateContext = createContext | undefined>(undefined); - const useContractsState = (): Readonly> | undefined => { + const ContractsStateContext = createContext(undefined); + const useContractsState = (): Readonly | undefined => { return useContext(ContractsStateContext); }; @@ -260,7 +358,7 @@ export const contractsContextFactory = < * @param chainId * @returns */ - const useAppContractsContext = ( + const useAppContractsContext = ( contractName: GContractNames, chainId: number | undefined ): GContract | undefined => { diff --git a/src/functions/index.ts b/src/functions/index.ts index 05ddaef2..e8745e35 100644 --- a/src/functions/index.ts +++ b/src/functions/index.ts @@ -3,4 +3,4 @@ export * from './ethersHelpers'; export * from './hookOptionsHelpers'; export * from './keyHelpers'; export * from './parseProviderOrSigner'; -export * from './sortContracts'; +// export * from './sortContracts'; diff --git a/src/functions/sortContracts.tsx b/src/functions/sortContracts.tsx index a212be52..abb8c8b5 100644 --- a/src/functions/sortContracts.tsx +++ b/src/functions/sortContracts.tsx @@ -1,45 +1,50 @@ -import { merge } from 'merge-anything'; +// export const sortContractsByChainId = < +// GContractNames extends string, +// GContracts extends TBaseContractExtended +// >( +// contractsByName: TContractsByName +// ): TContractsByChainId => { +// let contractsByChainId: TContractsByChainId = {}; -import { TContractsByName, TContractsByChainId } from '~~/models/contractContextTypes'; +// const names: GContractNames[] = Object.keys(contractsByName) as GContractNames[]; +// names.forEach((name) => { +// const chainIds = Object.keys(contractsByName[name]).map(Number); +// chainIds.forEach((chainId) => { +// const contracts: GContracts | undefined = contractsByName[name][chainId]; +// const data = { +// [chainId]: { [name]: contracts }, +// }; +// const temp = merge(contractsByChainId, data); +// // @ts-expect-error +// contractsByChainId = temp as TContractsByChainId; +// }); +// }); +// return contractsByChainId; +// }; -export const sortContractsByChainId = ( - contractsByName: TContractsByName -): TContractsByChainId => { - let contractsByChainId: TContractsByChainId = {} as TContractsByChainId; +// export const sortContractsByName = < +// GContractNames extends string, +// GContracts extends TBaseContractExtended +// >( +// contractsByChainId: TContractsByChainId +// ): TContractsByName => { +// const contractsByName: TContractsByName = {} as TContractsByName< +// GContractNames, +// GContracts +// >; - for (const nameStr in contractsByName) { - const name: GContractNames = nameStr; - for (const chainIdStr in contractsByName[name]) { - const chainId = parseInt(chainIdStr); - const data: TContractsByChainId = { - [chainId]: { [name]: contractsByName[name][chainId] }, - } as TContractsByChainId; - const temp = contractsByChainId; - // @ts-ignore - contractsByChainId = merge(temp, data); - } - } +// const chainIds = Object.keys(contractsByChainId).map(Number); +// chainIds.forEach((chainId) => { +// const names = Object.keys(contractsByChainId[chainId]) as GContractNames[]; +// names.forEach((name) => { +// const data = { +// [name]: { [chainId]: contractsByChainId[chainId][name] }, +// }; +// const temp = merge(contractsByName, data); +// // @ts-expect-error +// contractsByName = temp as TContractsByName; +// }); +// }); - return contractsByChainId; -}; - -export const sortContractsByName = ( - contractsByChainId: TContractsByChainId -): TContractsByName => { - let contractsByName: TContractsByName = {} as TContractsByName; - - for (const chainIdStr in contractsByChainId) { - const chainId = parseInt(chainIdStr); - for (const nameStr in contractsByChainId[chainId]) { - const name: GContractNames = nameStr; - const data: TContractsByName = { - [name]: { [chainId]: contractsByChainId[chainId][name] }, - } as TContractsByName; - const temp = contractsByName; - // @ts-ignore - contractsByName = merge(temp, data); - } - } - - return contractsByName; -}; +// return contractsByName; +// }; diff --git a/src/models/contractContextTypes.ts b/src/models/contractContextTypes.ts index 407ea580..7f1cee80 100644 --- a/src/models/contractContextTypes.ts +++ b/src/models/contractContextTypes.ts @@ -1,30 +1,36 @@ import { Provider } from '@ethersproject/providers'; -import { BaseContract, ethers, Signer } from 'ethers'; +import { BaseContract, Signer } from 'ethers'; export type TConnectorConnectorBase< - GContract extends BaseContract, - GContractInterface extends ethers.utils.Interface + GContract extends BaseContract + // GContractInterface extends ethers.utils.Interface > = { connect: (address: string, signerOrProvider: Signer | Provider) => GContract; - createInterface: () => GContractInterface; + // createInterface: () => GContractInterface; abi: Record[]; }; export type TContractConnector< GContractNames extends string, - GContract extends BaseContract, - GContractInterface extends ethers.utils.Interface + GContract extends BaseContract + // GContractInterface extends ethers.utils.Interface > = { contractName: GContractNames; config: { [chainId: number]: { address: string }; }; -} & TConnectorConnectorBase; +} & TConnectorConnectorBase; -export type TConnectorList = { - [contractName in GContactNames]: TContractConnector; +export type TBaseContractExtended = BaseContract & { contractName: GContractNames }; + +export type TConnectorList> = { + [contractName in GContractNames]: TContractConnector; }; +// export type TConnectorList = { +// [contractName in GContactNames]: TContractConnector; +// }; + export type TTypedContract< GContractNames extends string, GAppContractConnectorList @@ -32,35 +38,30 @@ export type TTypedContract< [key in GContractNames]: { connect: (address: any, signerOrProvider: any) => infer TypedContract }; } ? TypedContract - : BaseContract; + : TBaseContractExtended; -export type TContractsByName = Record< - GContractNames, - { [chainId: number]: BaseContract | undefined } ->; +export type TContractsByName< + GContractNames extends string, + GContracts extends TBaseContractExtended +> = { [contractName in GContractNames]: { [chainId in number]: GContracts | undefined } }; -export type TContractsByChainId = Record< - number, - { [contractName in GContractNames]: BaseContract | undefined } ->; +export type TContractsByChainId< + GContractNames extends string, + GContracts extends TBaseContractExtended +> = { + [chainId in number]: { + [contractName in GContractNames]: GContracts | undefined; + }; +}; /** * */ -export type TAppContractsContext = { - contractConnectors: TConnectorList; - contractsByName: TContractsByName; - contractsByChainId: TContractsByChainId; -}; -/** - * Creates a default state for the contracts context - * @returns - * @internal - */ -export const defaultAppContractsContext = (): TAppContractsContext => { - return { - contractConnectors: {} as TConnectorList, - contractsByName: {} as TContractsByName, - contractsByChainId: {} as TContractsByChainId, - }; +export type TAppContractsContext< + GContractNames extends string, + GContracts extends TBaseContractExtended +> = { + contractConnectors: TConnectorList; + contractsByName: TContractsByName; + contractsByChainId: TContractsByChainId; }; From 33469361a176c8e75262d847d75151def0f6ee48 Mon Sep 17 00:00:00 2001 From: Shravan Sunder Date: Sat, 15 Jan 2022 12:18:03 -0500 Subject: [PATCH 15/21] #125 better comments --- .../app-contracts/contractsContextFactory.tsx | 36 +++++++++++-------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/src/context/app-contracts/contractsContextFactory.tsx b/src/context/app-contracts/contractsContextFactory.tsx index 21543125..7e79bb10 100644 --- a/src/context/app-contracts/contractsContextFactory.tsx +++ b/src/context/app-contracts/contractsContextFactory.tsx @@ -32,6 +32,7 @@ export type TContractsContextProps = { /* *************** **************** ******************** */ /* *************** Actions & Dispatch ****************** */ +/* *************** **************** ******************** */ type TActionConnectToContract = { type: 'CONNECT_TO_CONTRACT'; @@ -77,6 +78,7 @@ export type TContractsContextActions>; useAppContractsActions: () => TContractsContextActions | undefined; - useAppContractsContext: ( - contractName: GContractNames, - chainId: number | undefined - ) => GContract | undefined; + useAppContractsContext: (contractName: GContractNames, chainId: number | undefined) => GContractsTypes | undefined; useLoadAppContracts: () => void; useConnectAppContracts: (adaptor: TEthersAdaptor | undefined) => void; } => { type GAppContractsContext = TAppContractsContext; - /* *************** ******** ************************************ */ - /* *************** Contract Helpers Functions ****************** */ + /* *************** ******** *************************** */ + /* *************** Helpers Functions ****************** */ + /* *************** ******** *************************** */ const defaultAppContractsContext = (): GAppContractsContext => { return { contractConnectors: {}, @@ -195,8 +195,9 @@ export const contractsContextFactory = < return state; }; - /* *************** ******** ****************************************** */ - /* *************** Contract Action Helper Functions ****************** */ + /* *************** ******** ************************** */ + /* *************** Action Functions ****************** */ + /* *************** ******** ************************** */ const connectToContractWithAdaptor = ( connector: TContractConnector, @@ -327,8 +328,9 @@ export const contractsContextFactory = < return state; }; - /* *************** ******** *************************** */ - /* *************** Contract Contexts ****************** */ + /* *************** ******** ****************** */ + /* *************** Contexts ****************** */ + /* *************** ******** ****************** */ /** * @internal */ @@ -349,8 +351,9 @@ export const contractsContextFactory = < return useContext(ContractsStateContext); }; - /* *************** ******** ************************ */ - /* *************** Contract Hooks ****************** */ + /* *************** ******** *************** */ + /* *************** Hooks ****************** */ + /* *************** ******** *************** */ /** * Get Contracts for the given contract name @@ -358,10 +361,10 @@ export const contractsContextFactory = < * @param chainId * @returns */ - const useAppContractsContext = ( + const useAppContractsContext = ( contractName: GContractNames, chainId: number | undefined - ): GContract | undefined => { + ): GContractsTypes | undefined => { const contractsState = useContractsState(); const ethersContext = useEthersContext(); const contract = contractsState?.contractsByName?.[contractName]?.[chainId ?? -1]; // -1 is unknown chainId @@ -382,7 +385,8 @@ export const contractsContextFactory = < ); chainIdRef.current = chainId; } - return contract as GContract; + + return contract; }; /** @@ -429,6 +433,8 @@ export const contractsContextFactory = < /* *************** ******** *************************** */ /* *************** Context Component ****************** */ + /* *************** ******** *************************** */ + /** * #### Summary * From d9f8313d8c429bc494a4adf1323382cb88385c53 Mon Sep 17 00:00:00 2001 From: Shravan Sunder Date: Sat, 15 Jan 2022 13:06:50 -0500 Subject: [PATCH 16/21] #125 some type changes --- .../app-contracts/contractsContextFactory.tsx | 23 ++++++++++++------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/src/context/app-contracts/contractsContextFactory.tsx b/src/context/app-contracts/contractsContextFactory.tsx index 7e79bb10..47761f97 100644 --- a/src/context/app-contracts/contractsContextFactory.tsx +++ b/src/context/app-contracts/contractsContextFactory.tsx @@ -24,6 +24,7 @@ import { TContractConnector, TContractsByChainId, TContractsByName, + TTypedContract, } from '~~/models/contractContextTypes'; export type TContractsContextProps = { @@ -76,9 +77,9 @@ export type TContractsContextActions>; }; -/* *************** **************** ****************** */ -/* *************** Contract Factory ****************** */ -/* *************** **************** ****************** */ +/* *************** ********************* ****************** */ +/* *************** 🏭 Contract Factory 🏭 ****************** */ +/* *************** ********************* ****************** */ /** * @@ -94,7 +95,10 @@ export const contractsContextFactory = < ): { ContractsAppContext: FC>; useAppContractsActions: () => TContractsContextActions | undefined; - useAppContractsContext: (contractName: GContractNames, chainId: number | undefined) => GContractsTypes | undefined; + useAppContractsContext: ( + contractName: GName, + chainId: number | undefined + ) => TTypedContract | undefined; useLoadAppContracts: () => void; useConnectAppContracts: (adaptor: TEthersAdaptor | undefined) => void; } => { @@ -361,10 +365,10 @@ export const contractsContextFactory = < * @param chainId * @returns */ - const useAppContractsContext = ( - contractName: GContractNames, + const useAppContractsContext = ( + contractName: GName, chainId: number | undefined - ): GContractsTypes | undefined => { + ): TTypedContract | undefined => { const contractsState = useContractsState(); const ethersContext = useEthersContext(); const contract = contractsState?.contractsByName?.[contractName]?.[chainId ?? -1]; // -1 is unknown chainId @@ -386,7 +390,10 @@ export const contractsContextFactory = < chainIdRef.current = chainId; } - return contract; + if (contract?.contractName) { + return contract as TTypedContract; + } + return undefined; }; /** From 683225130318b753c5c1129c49d00d8c4033f116 Mon Sep 17 00:00:00 2001 From: Shravan Sunder Date: Sat, 15 Jan 2022 13:27:37 -0500 Subject: [PATCH 17/21] #125 some type changes for simplicity --- .../app-contracts/contractsContextFactory.tsx | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/context/app-contracts/contractsContextFactory.tsx b/src/context/app-contracts/contractsContextFactory.tsx index 47761f97..e2ac5465 100644 --- a/src/context/app-contracts/contractsContextFactory.tsx +++ b/src/context/app-contracts/contractsContextFactory.tsx @@ -95,10 +95,10 @@ export const contractsContextFactory = < ): { ContractsAppContext: FC>; useAppContractsActions: () => TContractsContextActions | undefined; - useAppContractsContext: ( - contractName: GName, + useAppContracts: ( + contractName: GContractName, chainId: number | undefined - ) => TTypedContract | undefined; + ) => TTypedContract | undefined; useLoadAppContracts: () => void; useConnectAppContracts: (adaptor: TEthersAdaptor | undefined) => void; } => { @@ -365,10 +365,10 @@ export const contractsContextFactory = < * @param chainId * @returns */ - const useAppContractsContext = ( - contractName: GName, + const useAppContracts = ( + contractName: GContractName, chainId: number | undefined - ): TTypedContract | undefined => { + ): TTypedContract | undefined => { const contractsState = useContractsState(); const ethersContext = useEthersContext(); const contract = contractsState?.contractsByName?.[contractName]?.[chainId ?? -1]; // -1 is unknown chainId @@ -390,8 +390,8 @@ export const contractsContextFactory = < chainIdRef.current = chainId; } - if (contract?.contractName) { - return contract as TTypedContract; + if (contract) { + return contract as TTypedContract; } return undefined; }; @@ -487,7 +487,7 @@ export const contractsContextFactory = < return { ContractsAppContext: ContractsAppContext, useAppContractsActions, - useAppContractsContext, + useAppContracts, useLoadAppContracts, useConnectAppContracts, }; From b0a58e2345b386a3a7d5d47301197901a131013d Mon Sep 17 00:00:00 2001 From: Shravan Sunder Date: Sun, 16 Jan 2022 17:18:26 -0500 Subject: [PATCH 18/21] #126 added status return type. made react query options available. better options typeing --- .../app-contracts/contractsContextFactory.tsx | 2 +- src/functions/hookOptionsHelpers.ts | 21 ++++++- src/functions/sortContracts.tsx | 2 +- src/hooks/dapps/useDexEthPrice.ts | 16 +++--- src/hooks/dapps/useDexTokenList.ts | 12 ++-- src/hooks/dapps/useResolveEnsAddress.ts | 8 +-- src/hooks/dapps/useResolveEnsName.ts | 8 +-- src/hooks/erc/useTokenBalance.ts | 14 ++--- src/hooks/useAreSignerEqual.ts | 55 +++++++++--------- src/hooks/useBalance.ts | 41 ++++++++----- src/hooks/useBlockNumber.ts | 57 +++++++++++-------- src/hooks/useContractExistsAtAddress.ts | 14 ++--- src/hooks/useContractReader.ts | 21 ++++--- .../useEthersAdaptorFromProviderOrSigners.ts | 11 ++-- src/hooks/useEthersUpdater.ts | 9 ++- src/hooks/useEventListener.ts | 12 ++-- src/hooks/useGasPrice.ts | 11 ++-- src/hooks/useNonce.ts | 13 +++-- src/hooks/useSignerAddress.ts | 45 ++++++++------- src/hooks/useSignerChainId.ts | 16 +++--- src/hooks/useTimestamp.ts | 11 ++-- ...extTypes.ts => contractAppContextTypes.ts} | 0 src/models/{hookOptions.ts => hookTypes.ts} | 23 +++++--- src/models/index.ts | 4 +- 24 files changed, 245 insertions(+), 181 deletions(-) rename src/models/{contractContextTypes.ts => contractAppContextTypes.ts} (100%) rename src/models/{hookOptions.ts => hookTypes.ts} (53%) diff --git a/src/context/app-contracts/contractsContextFactory.tsx b/src/context/app-contracts/contractsContextFactory.tsx index 2603f7a9..b37b8703 100644 --- a/src/context/app-contracts/contractsContextFactory.tsx +++ b/src/context/app-contracts/contractsContextFactory.tsx @@ -17,7 +17,7 @@ import { connectToContractWithAdaptor, useEthersContext } from '~~/context'; import { invalidateCache, isValidEthersAdaptor, sortContractsByChainId, sortContractsByName } from '~~/functions'; import { TTypedContract, TEthersAdaptor, TConnectorList } from '~~/models'; import { keyNamespace } from '~~/models/constants'; -import { TAppContractsContext, defaultAppContractsContext, TContractsByName } from '~~/models/contractContextTypes'; +import { TAppContractsContext, defaultAppContractsContext, TContractsByName } from '~~/models/contractAppContextTypes'; export type TContractsContextProps = { ethersContextKey?: string | undefined; diff --git a/src/functions/hookOptionsHelpers.ts b/src/functions/hookOptionsHelpers.ts index 10afe0f8..bc119583 100644 --- a/src/functions/hookOptionsHelpers.ts +++ b/src/functions/hookOptionsHelpers.ts @@ -10,6 +10,7 @@ import { defaultOverride, TUpdateOptions, defaultUpdateOptions, + TQueryOptions, } from '~~/models'; import { DeepPartial } from '~~/models/utilityTypes'; @@ -29,9 +30,9 @@ export const ethersOverride = (context: IEthersContext, options: TOverride): Rea export const checkUpdateOptions = (context: IEthersContext, update: TUpdateOptions): void => { // check if there is an override - if (update.query.refetchInterval) { + if (update.refetchInterval) { invariant( - update.query.refetchInterval == null || update.query.refetchInterval >= 10000, + update.refetchInterval == null || update.refetchInterval >= 10000, 'Invalid refetchInterval (polling), must be at least 10000ms or undefined (disabled)' ); invariant( @@ -53,7 +54,9 @@ export const mergeDefaultOverride = (...overrides: DeepPartial[]): TO return defaultOptions; }; -export const mergeDefaultUpdateOptions = (...overrides: DeepPartial[]): TUpdateOptions => { +export const mergeDefaultUpdateOptions = ( + ...overrides: DeepPartial>[] +): TUpdateOptions => { const defaultOptions: TUpdateOptions = defaultUpdateOptions(); if (overrides?.length > 0) { @@ -66,3 +69,15 @@ export const mergeDefaultUpdateOptions = (...overrides: DeepPartial { return mergeDefaultOverride({ adaptor, adaptorEnabled: enabled }); }; + +export const processQueryOptions = ( + options: TUpdateOptions +): typeof options.query & { refetchInterval?: number } => { + const queryOptions: TQueryOptions & { refetchInterval?: number } = { ...options.query }; + + if (options.refetchInterval) { + queryOptions.enabled = true; + queryOptions.refetchInterval = options.refetchInterval; + } + return queryOptions; +}; diff --git a/src/functions/sortContracts.tsx b/src/functions/sortContracts.tsx index a212be52..a7691d00 100644 --- a/src/functions/sortContracts.tsx +++ b/src/functions/sortContracts.tsx @@ -1,6 +1,6 @@ import { merge } from 'merge-anything'; -import { TContractsByName, TContractsByChainId } from '~~/models/contractContextTypes'; +import { TContractsByName, TContractsByChainId } from '~~/models/contractAppContextTypes'; export const sortContractsByChainId = ( contractsByName: TContractsByName diff --git a/src/hooks/dapps/useDexEthPrice.ts b/src/hooks/dapps/useDexEthPrice.ts index f22a23b1..06cfe36b 100644 --- a/src/hooks/dapps/useDexEthPrice.ts +++ b/src/hooks/dapps/useDexEthPrice.ts @@ -2,9 +2,9 @@ import { Token, WETH, Fetcher, Route } from '@uniswap/sdk'; import { useQuery } from 'react-query'; import { useBlockNumberContext } from '~~/context'; -import { mergeDefaultUpdateOptions, providerKey, TRequiredKeys } from '~~/functions'; +import { mergeDefaultUpdateOptions, processQueryOptions, providerKey, TRequiredKeys } from '~~/functions'; import { useEthersUpdater } from '~~/hooks/useEthersUpdater'; -import { TNetworkInfo, TUpdateOptions } from '~~/models'; +import { THookResult, TNetworkInfo, TUpdateOptions } from '~~/models'; import { keyNamespace } from '~~/models/constants'; import { TEthersProvider } from '~~/models/providerTypes'; @@ -28,11 +28,13 @@ export const useDexEthPrice = ( mainnetProvider: TEthersProvider | undefined, targetNetworkInfo?: TNetworkInfo, options: TUpdateOptions = mergeDefaultUpdateOptions() -): [price: number, update: () => void] => { +): THookResult => { const keys = [{ ...queryKey, ...providerKey(mainnetProvider) }, { networkPrice: targetNetworkInfo?.price }] as const; - const { data, refetch } = useQuery( + type TAsyncResult = number | undefined; + + const { data, refetch, status } = useQuery( keys, - async (keys): Promise => { + async (keys): Promise => { const { networkPrice } = keys.queryKey[1]; if (networkPrice) { return networkPrice; @@ -47,12 +49,12 @@ export const useDexEthPrice = ( } }, { - ...options.query, + ...processQueryOptions(options), } ); const blockNumber = useBlockNumberContext(); useEthersUpdater(refetch, blockNumber, options); - return [data ?? 0, refetch]; + return [data ?? 0, refetch, status]; }; diff --git a/src/hooks/dapps/useDexTokenList.ts b/src/hooks/dapps/useDexTokenList.ts index 229bae70..c11c61ff 100644 --- a/src/hooks/dapps/useDexTokenList.ts +++ b/src/hooks/dapps/useDexTokenList.ts @@ -4,9 +4,9 @@ import isEqual from 'lodash.isequal'; import { useQuery } from 'react-query'; import { useBlockNumberContext } from '~~/context'; -import { mergeDefaultUpdateOptions, TRequiredKeys } from '~~/functions'; +import { mergeDefaultUpdateOptions, processQueryOptions, TRequiredKeys } from '~~/functions'; import { useEthersUpdater } from '~~/hooks/useEthersUpdater'; -import { TUpdateOptions } from '~~/models'; +import { THookResult, TUpdateOptions } from '~~/models'; import { keyNamespace } from '~~/models/constants'; const queryKey: TRequiredKeys = { namespace: keyNamespace.signer, key: 'useDexTokenList' } as const; @@ -28,9 +28,9 @@ export const useDexTokenList = ( tokenListUri: string = 'https://gateway.ipfs.io/ipns/tokens.uniswap.org', chainId?: number, options: TUpdateOptions = mergeDefaultUpdateOptions() -): [tokenList: TokenInfo[], update: () => void] => { +): THookResult => { const keys = [{ ...queryKey }, { tokenListUri, chainId }] as const; - const { data, refetch } = useQuery( + const { data, refetch, status } = useQuery( keys, async (keys): Promise => { const { tokenListUri, chainId } = keys.queryKey[1]; @@ -48,13 +48,13 @@ export const useDexTokenList = ( return tokenInfo; }, { + ...processQueryOptions(options), isDataEqual: (oldResult, newResult) => isEqual(oldResult, newResult), - ...options.query, } ); const blockNumber = useBlockNumberContext(); useEthersUpdater(refetch, blockNumber, options); - return [data ?? [], refetch]; + return [data ?? [], refetch, status]; }; diff --git a/src/hooks/dapps/useResolveEnsAddress.ts b/src/hooks/dapps/useResolveEnsAddress.ts index c9bf1d73..ee5278b6 100644 --- a/src/hooks/dapps/useResolveEnsAddress.ts +++ b/src/hooks/dapps/useResolveEnsAddress.ts @@ -2,7 +2,7 @@ import { constants } from 'ethers'; import { useQuery } from 'react-query'; import { providerKey, TRequiredKeys } from '~~/functions'; -import { keyNamespace, TEthersProvider } from '~~/models'; +import { keyNamespace, TEthersProvider, THookResult } from '~~/models'; const queryKey: TRequiredKeys = { namespace: keyNamespace.signer, key: 'useResolveEnsAddress' } as const; @@ -19,9 +19,9 @@ const queryKey: TRequiredKeys = { namespace: keyNamespace.signer, key: 'useResol export const useResolveEnsAddress = ( mainnetProvider: TEthersProvider | undefined, ensName: string | undefined -): [address: string | undefined, update: () => void] => { +): THookResult => { const keys = [{ ...queryKey, ...providerKey(mainnetProvider) }, { ensName }] as const; - const { data, refetch } = useQuery(keys, async (keys): Promise => { + const { data, refetch, status } = useQuery(keys, async (keys): Promise => { const { ensName } = keys.queryKey[1]; if (mainnetProvider && ensName) { const resolved = await mainnetProvider.resolveName(ensName); @@ -30,5 +30,5 @@ export const useResolveEnsAddress = ( return constants.AddressZero; }); - return [data, refetch]; + return [data, refetch, status]; }; diff --git a/src/hooks/dapps/useResolveEnsName.ts b/src/hooks/dapps/useResolveEnsName.ts index c0bc10cc..fa0014d9 100644 --- a/src/hooks/dapps/useResolveEnsName.ts +++ b/src/hooks/dapps/useResolveEnsName.ts @@ -2,7 +2,7 @@ import { utils, constants } from 'ethers'; import { useQuery } from 'react-query'; import { providerKey, TRequiredKeys } from '~~/functions'; -import { keyNamespace, TEthersProvider } from '~~/models'; +import { keyNamespace, TEthersProvider, THookResult } from '~~/models'; const queryKey: TRequiredKeys = { namespace: keyNamespace.signer, key: 'useResolveEnsName' } as const; @@ -45,9 +45,9 @@ const lookupAddress = async (provider: TEthersProvider, address: string): Promis export const useResolveEnsName = ( mainnetProvider: TEthersProvider | undefined, address: string -): [ensName: string | undefined, update: () => void] => { +): THookResult => { const keys = [{ ...queryKey, ...providerKey(mainnetProvider) }, { address }] as const; - const { data, refetch } = useQuery(keys, async (keys): Promise => { + const { data, refetch, status } = useQuery(keys, async (keys): Promise => { const { address } = keys.queryKey[1]; const storedData: any = window.localStorage.getItem('ethhooks_ensCache_' + address); @@ -73,5 +73,5 @@ export const useResolveEnsName = ( } }); - return [data, refetch]; + return [data, refetch, status]; }; diff --git a/src/hooks/erc/useTokenBalance.ts b/src/hooks/erc/useTokenBalance.ts index 89891066..5300ad7f 100644 --- a/src/hooks/erc/useTokenBalance.ts +++ b/src/hooks/erc/useTokenBalance.ts @@ -3,9 +3,9 @@ import { BaseContract } from '@ethersproject/contracts'; import { useQuery } from 'react-query'; import { useBlockNumberContext } from '~~/context'; -import { contractKey, mergeDefaultUpdateOptions, TRequiredKeys } from '~~/functions'; +import { contractKey, mergeDefaultUpdateOptions, processQueryOptions, TRequiredKeys } from '~~/functions'; import { useEthersUpdater } from '~~/hooks/useEthersUpdater'; -import { TUpdateOptions } from '~~/models'; +import { THookResult, TUpdateOptions } from '~~/models'; import { keyNamespace } from '~~/models/constants'; const zero = BigNumber.from(0); @@ -34,9 +34,9 @@ export const useTokenBalance = ( contract: GContract, address: string, options: TUpdateOptions = mergeDefaultUpdateOptions() -): [balance: BigNumber, update: () => void] => { +): THookResult => { const keys = [{ ...queryKey, ...contractKey(contract) }, { address }] as const; - const { data, refetch } = useQuery( + const { data, refetch, status } = useQuery( keys, async (keys): Promise => { const { address } = keys.queryKey[1]; @@ -49,13 +49,13 @@ export const useTokenBalance = ( } }, { - isDataEqual: (oldResult, newResult) => oldResult?._hex === newResult._hex, - ...options.query, + ...processQueryOptions(options), + isDataEqual: (oldResult, newResult) => oldResult?._hex === newResult?._hex, } ); const blockNumber = useBlockNumberContext(); useEthersUpdater(refetch, blockNumber, options); - return [data ?? zero, refetch]; + return [data ?? zero, refetch, status]; }; diff --git a/src/hooks/useAreSignerEqual.ts b/src/hooks/useAreSignerEqual.ts index 72001d55..498bbda5 100644 --- a/src/hooks/useAreSignerEqual.ts +++ b/src/hooks/useAreSignerEqual.ts @@ -1,9 +1,11 @@ -import { useState, useEffect, useCallback } from 'react'; -import { useIsMounted } from 'usehooks-ts'; +import { useQuery } from 'react-query'; import { useBlockNumberContext } from '~~/context'; -import { signerHasNetwork } from '~~/functions'; -import { TEthersSigner } from '~~/models'; +import { mergeDefaultUpdateOptions, processQueryOptions, providerKey, signerHasNetwork } from '~~/functions'; +import { useEthersUpdater } from '~~/hooks/useEthersUpdater'; +import { keyNamespace, TEthersSigner, THookResult, TUpdateOptions } from '~~/models'; + +const queryKey = { namespace: keyNamespace.signer, key: 'useAreSignerEqual' } as const; /** * #### Summary @@ -16,31 +18,32 @@ import { TEthersSigner } from '~~/models'; */ export const useAreSignerEqual = ( signer1: TEthersSigner | undefined, - signer2: TEthersSigner | undefined -): [isEqual: boolean | undefined, update: () => void] => { - const isMounted = useIsMounted(); - const [isEqual, setIsEqual] = useState(); - const blockNumber = useBlockNumberContext(); - - const update = useCallback(async (): Promise => { - if (signerHasNetwork(signer1)) { - const chainId1 = await signer1?.getChainId(); - const chainId2 = await signer2?.getChainId(); + signer2: TEthersSigner | undefined, + options: TUpdateOptions = mergeDefaultUpdateOptions() +): THookResult => { + const keys = [{ ...queryKey }, { singer1Key: providerKey(signer1), signer2Key: providerKey(signer2) }] as const; + const { data, refetch, status } = useQuery( + keys, + async (keys): Promise => { + if (signerHasNetwork(signer1)) { + const chainId1 = await signer1?.getChainId(); + const chainId2 = await signer2?.getChainId(); - const address1 = await signer1?.getAddress(); - const address2 = await signer2?.getAddress(); - const isEqual = - address1 === address2 && chainId1 === chainId2 && address1 !== undefined && chainId1 !== undefined; - - if (isMounted()) { - setIsEqual(isEqual); + const address1 = await signer1?.getAddress(); + const address2 = await signer2?.getAddress(); + const isEqual = + address1 === address2 && chainId1 === chainId2 && address1 !== undefined && chainId1 !== undefined; + return isEqual; } + return undefined; + }, + { + ...processQueryOptions(options), } - }, [isMounted, signer1, signer2]); + ); - useEffect(() => { - void update(); - }, [blockNumber, update]); + const blockNumber = useBlockNumberContext(); + useEthersUpdater(refetch, blockNumber, options); - return [isEqual, update]; + return [data, refetch, status]; }; diff --git a/src/hooks/useBalance.ts b/src/hooks/useBalance.ts index 409e355a..3f61a1d1 100644 --- a/src/hooks/useBalance.ts +++ b/src/hooks/useBalance.ts @@ -4,17 +4,23 @@ import { useQuery } from 'react-query'; import { useEthersUpdater } from './useEthersUpdater'; import { useEthersContext, useBlockNumberContext } from '~~/context'; -import { asyncForEach, ethersOverride, mergeDefaultOverride, mergeDefaultUpdateOptions } from '~~/functions'; +import { + asyncForEach, + ethersOverride, + mergeDefaultOverride, + mergeDefaultUpdateOptions, + processQueryOptions, +} from '~~/functions'; import { providerKey, TRequiredKeys } from '~~/functions/keyHelpers'; -import { TOverride, TUpdateOptions } from '~~/models'; +import { THookResult, TOverride, TUpdateOptions } from '~~/models'; import { keyNamespace } from '~~/models/constants'; const queryKey: TRequiredKeys = { namespace: keyNamespace.signer, key: 'useBalance' }; const zero = BigNumber.from(0); -type TUseBalanceResult> = GAddress extends string[] - ? Record +type TUseBalanceResult = GAddress extends string[] + ? Record : BigNumber; /** @@ -31,44 +37,51 @@ type TUseBalanceResult> = GAddress exten * @param options * @returns current balance */ -export const useBalance = , GResult = TUseBalanceResult>( +export const useBalance = >( addresses: GAddress | undefined, override: TOverride = mergeDefaultOverride(), options: TUpdateOptions = mergeDefaultUpdateOptions() -): [balance: GResult | undefined, update: () => void] => { +): THookResult> => { const ethersContext = useEthersContext(override.alternateContextKey); const { provider } = ethersOverride(ethersContext, override); const keys = [{ ...queryKey, ...providerKey(provider) }, { addresses }] as const; - const { data, refetch } = useQuery( + const { data, refetch, status } = useQuery( keys, - async (keys) => { + async (keys): Promise | undefined> => { const { addresses } = keys.queryKey[1]; if (provider && addresses) { if (Array.isArray(addresses)) { - const result: Record = {}; + const result: TUseBalanceResult = {}; await asyncForEach(addresses, async (address: string) => { const balance = await provider.getBalance(address); result[address] = balance; }); - return result; + return result as TUseBalanceResult; } else { const address: string = addresses; const newBalance = await provider.getBalance(address); - return newBalance; + return newBalance as TUseBalanceResult; } } return undefined; }, { - // isDataEqual: (oldResult, newResult) => oldResult?._hex === newResult._hex, - ...options.query, + ...processQueryOptions | undefined>(options), + isDataEqual: (oldResult, newResult) => oldResult?._hex === newResult?._hex, } ); const blockNumber = useBlockNumberContext(); useEthersUpdater(refetch, blockNumber, options); - return [data as unknown as GResult | undefined, refetch]; + let result: TUseBalanceResult; + if (Array.isArray(addresses)) { + result = data ?? ({} as TUseBalanceResult); + } else { + result = data ?? (zero as TUseBalanceResult); + } + + return [result, refetch, status]; }; diff --git a/src/hooks/useBlockNumber.ts b/src/hooks/useBlockNumber.ts index c19d75c6..a9065ce9 100644 --- a/src/hooks/useBlockNumber.ts +++ b/src/hooks/useBlockNumber.ts @@ -1,7 +1,10 @@ -import { useCallback, useEffect, useState } from 'react'; -import { useCounter, useIsMounted } from 'usehooks-ts'; +import { useEffect } from 'react'; +import { useQuery } from 'react-query'; -import { TEthersProvider } from '~~/models'; +import { mergeDefaultUpdateOptions, processQueryOptions, providerKey, TRequiredKeys } from '~~/functions'; +import { keyNamespace, TEthersProvider, THookResult, TUpdateOptions } from '~~/models'; + +const queryKey: TRequiredKeys = { namespace: keyNamespace.signer, key: 'useBlockNumber' }; /** * #### Summary @@ -18,30 +21,36 @@ import { TEthersProvider } from '~~/models'; */ export const useBlockNumber = ( provider: TEthersProvider | undefined, - callback?: ((blockNumber?: number) => void) | ((blockNumber?: number) => Promise) -): [blockNumber: number, update: () => void] => { - const isMounted = useIsMounted(); + callback?: ((blockNumber?: number) => void) | ((blockNumber?: number) => Promise), + options: TUpdateOptions = mergeDefaultUpdateOptions() +): THookResult => { + type TAsyncResult = number | undefined; + const keys = [ + { + ...queryKey, + ...providerKey(provider), + }, + ] as const; - const [blockNumber, setBlockNumber] = useState(0); + const { data, refetch, status } = useQuery( + keys, + async (keys): Promise => { + if (provider) { + const nextBlockNumber = await provider?.getBlockNumber(); + return nextBlockNumber; + } - const update = useCallback(async (): Promise => { - const nextBlockNumber = await provider?.getBlockNumber(); - if (isMounted() && provider != null) { - setBlockNumber((value) => { - if (value !== nextBlockNumber) { - return nextBlockNumber ?? 0; - } - return value; - }); + return undefined; + }, + { + ...processQueryOptions(options), } - }, [provider, isMounted]); + ); useEffect(() => { if (provider) { const listener = (blockNumberLocal: number): void => { - if (isMounted()) { - void setBlockNumber(blockNumberLocal); - } + void refetch(); if (callback != null) { try { @@ -53,8 +62,8 @@ export const useBlockNumber = ( }; provider?.addListener?.('block', listener); - if (blockNumber == null) { - void update(); + if (data == null) { + void refetch(); } return (): void => { @@ -62,7 +71,7 @@ export const useBlockNumber = ( }; } // eslint-disable-next-line react-hooks/exhaustive-deps - }, [provider, isMounted, update]); + }, [callback, provider, refetch]); - return [blockNumber, update]; + return [data ?? 0, refetch, status]; }; diff --git a/src/hooks/useContractExistsAtAddress.ts b/src/hooks/useContractExistsAtAddress.ts index 8599fb87..2c0c452a 100644 --- a/src/hooks/useContractExistsAtAddress.ts +++ b/src/hooks/useContractExistsAtAddress.ts @@ -2,9 +2,9 @@ import { BaseContract, utils } from 'ethers'; import { useQuery } from 'react-query'; import { useBlockNumberContext } from '~~/context'; -import { contractKey, mergeDefaultUpdateOptions, TRequiredKeys } from '~~/functions'; +import { contractKey, mergeDefaultUpdateOptions, processQueryOptions, TRequiredKeys } from '~~/functions'; import { useEthersUpdater } from '~~/hooks/useEthersUpdater'; -import { TUpdateOptions } from '~~/models'; +import { THookResult, TUpdateOptions } from '~~/models'; import { keyNamespace } from '~~/models/constants'; const queryKey: TRequiredKeys = { namespace: keyNamespace.contracts, key: 'useContractExistsAtAddress' } as const; @@ -24,10 +24,10 @@ const queryKey: TRequiredKeys = { namespace: keyNamespace.contracts, key: 'useCo */ export const useContractExistsAtAddress = ( contract: BaseContract | undefined, - options: TUpdateOptions = mergeDefaultUpdateOptions() -): [contractIsDeployed: boolean, update: () => void] => { + options: TUpdateOptions = mergeDefaultUpdateOptions() +): THookResult => { const keys = [{ ...queryKey, ...contractKey(contract) }, { contractAddress: contract?.address }] as const; - const { data, refetch } = useQuery( + const { data, refetch, status } = useQuery( keys, async (keys): Promise => { const { contractAddress } = keys.queryKey[1]; @@ -43,12 +43,12 @@ export const useContractExistsAtAddress = ( return false; }, { - ...options.query, + ...processQueryOptions(options), } ); const blockNumber = useBlockNumberContext(); useEthersUpdater(refetch, blockNumber, options); - return [data ?? false, refetch]; + return [data ?? false, refetch, status]; }; diff --git a/src/hooks/useContractReader.ts b/src/hooks/useContractReader.ts index 79cc8839..07ec9d08 100644 --- a/src/hooks/useContractReader.ts +++ b/src/hooks/useContractReader.ts @@ -4,9 +4,15 @@ import { useQuery } from 'react-query'; import { useIsMounted } from 'usehooks-ts'; import { useEthersContext, useBlockNumberContext } from '~~/context'; -import { contractFuncKey, ethersOverride, mergeDefaultOverride, mergeDefaultUpdateOptions } from '~~/functions'; +import { + contractFuncKey, + ethersOverride, + mergeDefaultOverride, + mergeDefaultUpdateOptions, + processQueryOptions, +} from '~~/functions'; import { useEthersUpdater } from '~~/hooks/useEthersUpdater'; -import { TContractFunctionInfo, TOverride, TUpdateOptions } from '~~/models'; +import { TContractFunctionInfo, THookResult, TOverride, TUpdateOptions } from '~~/models'; import { keyNamespace } from '~~/models/constants'; const queryKey = { namespace: keyNamespace.contracts, key: 'useContractReader' } as const; @@ -33,7 +39,7 @@ export const useContractReader = < args?: Parameters, funcEventFilter?: EventFilter | undefined, options: TUpdateOptions = mergeDefaultUpdateOptions() -): [value: Awaited> | undefined, update: () => void] => { +): THookResult> | undefined> => { const keys = [ { ...queryKey, @@ -41,12 +47,13 @@ export const useContractReader = < }, { args: args ?? [], funcEventFilter }, ] as const; - const { data, refetch } = useQuery( + const { data, refetch, status } = useQuery( keys, - async (keys) => { + async (keys): Promise> | undefined> => { const { args } = keys.queryKey[1]; if (contractFunc != null && contract != null) { + // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment const result = await contractFunc(...args); // eslint-disable-next-line @typescript-eslint/no-unsafe-return return result; @@ -55,7 +62,7 @@ export const useContractReader = < return undefined; }, { - ...options.query, + ...processQueryOptions> | undefined>(options), } ); @@ -86,7 +93,7 @@ export const useContractReader = < const allowBlockNumberIntervalUpdate = funcEventFilter == null; useEthersUpdater(refetch, blockNumber, options, allowBlockNumberIntervalUpdate); - return [data, refetch]; + return [data, refetch, status]; }; /** diff --git a/src/hooks/useEthersAdaptorFromProviderOrSigners.ts b/src/hooks/useEthersAdaptorFromProviderOrSigners.ts index 568b0da5..4e120c41 100644 --- a/src/hooks/useEthersAdaptorFromProviderOrSigners.ts +++ b/src/hooks/useEthersAdaptorFromProviderOrSigners.ts @@ -6,10 +6,11 @@ import { isValidEthersAdaptor, mergeDefaultUpdateOptions, parseProviderOrSigner, + processQueryOptions, providerKey, TRequiredKeys, } from '~~/functions'; -import { TEthersProviderOrSigner, TUpdateOptions } from '~~/models'; +import { TEthersProviderOrSigner, THookResult, TUpdateOptions } from '~~/models'; import { keyNamespace } from '~~/models/constants'; import { TEthersAdaptor } from '~~/models/ethersAppContextTypes'; @@ -30,17 +31,17 @@ const queryKey: TRequiredKeys = { export const useEthersAdaptorFromProviderOrSigners = ( providerOrSigner: TEthersProviderOrSigner | undefined, options: TUpdateOptions = mergeDefaultUpdateOptions() -): [adaptor: TEthersAdaptor | undefined, update: () => void] => { +): THookResult => { const keys = [{ ...queryKey, ...providerKey(providerOrSigner) }] as const; - const { data, refetch } = useQuery( + const { data, refetch, status } = useQuery( keys, async (_keys): Promise => { const result = await parseProviderOrSigner(providerOrSigner); return result; }, { + ...processQueryOptions(options), isDataEqual: (oldData, newData) => isAdaptorEqual(oldData, newData), - ...options.query, } ); @@ -64,5 +65,5 @@ export const useEthersAdaptorFromProviderOrSigners = ( } }, [data, refetch, validAdaptorState]); - return [data, refetch]; + return [data, refetch, status]; }; diff --git a/src/hooks/useEthersUpdater.ts b/src/hooks/useEthersUpdater.ts index bdb238b1..087624f6 100644 --- a/src/hooks/useEthersUpdater.ts +++ b/src/hooks/useEthersUpdater.ts @@ -11,9 +11,12 @@ export const useEthersUpdater = ( const blockNumberFilter = Math.floor((blockNumber ?? 0) / (options.blockNumberInterval ?? 1)); useEffect(() => { - if (blockNumber != null && !options.query.refetchInterval && allowBlockNumberUpdate) { - void update(); + if (allowBlockNumberUpdate) { + // update if blocknumber or if polling + if (blockNumber != null && !options.refetchInterval) { + void update(); + } } // eslint-disable-next-line react-hooks/exhaustive-deps - }, [blockNumberFilter, update, options.query.refetchInterval]); + }, [blockNumberFilter, update, options.refetchInterval]); }; diff --git a/src/hooks/useEventListener.ts b/src/hooks/useEventListener.ts index 392d4576..4ad1ad9e 100644 --- a/src/hooks/useEventListener.ts +++ b/src/hooks/useEventListener.ts @@ -3,8 +3,8 @@ import { Result } from 'ethers/lib/utils'; import { useEffect } from 'react'; import { useQuery } from 'react-query'; -import { contractKey, mergeDefaultUpdateOptions, TRequiredKeys } from '~~/functions'; -import { const_blockNumberInterval100, TUpdateOptions, TypedEvent } from '~~/models'; +import { contractKey, mergeDefaultUpdateOptions, processQueryOptions, TRequiredKeys } from '~~/functions'; +import { const_blockNumberInterval100, THookResult, TUpdateOptions, TypedEvent } from '~~/models'; import { keyNamespace } from '~~/models/constants'; const queryKey: TRequiredKeys = { namespace: keyNamespace.contracts, key: 'useEventListener' } as const; @@ -29,7 +29,7 @@ export const useEventListener = >( startBlock: number, toBlock: number | undefined = undefined, options: TUpdateOptions = mergeDefaultUpdateOptions({ ...const_blockNumberInterval100 }) -): [eventMap: GTypedEvent[], queryEvents: () => void] => { +): THookResult => { const keys = [ { ...queryKey, @@ -41,7 +41,7 @@ export const useEventListener = >( toBlock, }, ] as const; - const { data, refetch } = useQuery( + const { data, refetch, status } = useQuery( keys, async (keys): Promise => { { @@ -51,7 +51,7 @@ export const useEventListener = >( } }, { - ...options.query, + ...processQueryOptions(options), } ); @@ -75,5 +75,5 @@ export const useEventListener = >( // const blockNumber = useBlockNumberContext(); // useEthersUpdater(refetch, blockNumber, options); - return [data ?? [], refetch]; + return [data ?? [], refetch, status]; }; diff --git a/src/hooks/useGasPrice.ts b/src/hooks/useGasPrice.ts index 7a168a79..2b07f786 100644 --- a/src/hooks/useGasPrice.ts +++ b/src/hooks/useGasPrice.ts @@ -8,11 +8,12 @@ import { ethersOverride, mergeDefaultOverride, mergeDefaultUpdateOptions, + processQueryOptions, providerKey, TRequiredKeys, } from '~~/functions'; import { useEthersUpdater } from '~~/hooks/useEthersUpdater'; -import { TOverride, TNetworkInfo, TUpdateOptions, keyNamespace } from '~~/models'; +import { TOverride, TNetworkInfo, TUpdateOptions, keyNamespace, THookResult } from '~~/models'; const queryKey: TRequiredKeys = { namespace: keyNamespace.state, key: 'useGasPrice' } as const; @@ -51,7 +52,7 @@ export const useGasPrice = ( currentNetworkInfo?: TNetworkInfo, override: TOverride = mergeDefaultOverride(), options: TUpdateOptions = mergeDefaultUpdateOptions() -): [gasPrice: number | undefined, update: () => void] => { +): THookResult => { const ethersContext = useEthersContext(override.alternateContextKey); const { provider } = ethersOverride(ethersContext, override); @@ -59,7 +60,7 @@ export const useGasPrice = ( { ...queryKey, ...providerKey(provider) }, { chainId, speed, currentNetworkInfo }, ] as const; - const { data, refetch, isError } = useQuery( + const { data, refetch, isError, status } = useQuery( keys, async (keys): Promise => { const { chainId, speed, currentNetworkInfo } = keys.queryKey[1]; @@ -89,7 +90,7 @@ export const useGasPrice = ( return undefined; }, { - ...options.query, + ...processQueryOptions(options), } ); @@ -98,5 +99,5 @@ export const useGasPrice = ( const result = isError ? undefined : data; const [gasPriceDebounced] = useDebounce(result, 250, { trailing: true }); - return [gasPriceDebounced, refetch]; + return [gasPriceDebounced, refetch, status]; }; diff --git a/src/hooks/useNonce.ts b/src/hooks/useNonce.ts index 7cfe0827..58061330 100644 --- a/src/hooks/useNonce.ts +++ b/src/hooks/useNonce.ts @@ -5,11 +5,12 @@ import { ethersOverride, mergeDefaultOverride, mergeDefaultUpdateOptions, + processQueryOptions, providerKey, TRequiredKeys, } from '~~/functions'; import { useEthersUpdater } from '~~/hooks/useEthersUpdater'; -import { TOverride, TUpdateOptions } from '~~/models'; +import { THookResult, TOverride, TUpdateOptions } from '~~/models'; import { keyNamespace } from '~~/models/constants'; const queryKey: TRequiredKeys = { @@ -34,14 +35,14 @@ export const useNonce = ( address: string | undefined, override: TOverride = mergeDefaultOverride(), options: TUpdateOptions = mergeDefaultUpdateOptions() -): [nonce: number, update: () => void] => { +): THookResult => { const ethersContext = useEthersContext(override.alternateContextKey); const { provider } = ethersOverride(ethersContext, override); const keys = [{ ...queryKey, ...providerKey(provider) }, { address }] as const; - const { data, refetch } = useQuery( + const { data, refetch, status } = useQuery( keys, - async (keys) => { + async (keys): Promise => { const { address } = keys.queryKey[1]; if (address) { const nextNonce = await provider?.getTransactionCount(address); @@ -50,12 +51,12 @@ export const useNonce = ( return undefined; }, { - ...options.query, + ...processQueryOptions(options), } ); const blockNumber = useBlockNumberContext(); useEthersUpdater(refetch, blockNumber, options); - return [data ?? 0, refetch]; + return [data ?? 0, refetch, status]; }; diff --git a/src/hooks/useSignerAddress.ts b/src/hooks/useSignerAddress.ts index 48000b5c..89dc91bc 100644 --- a/src/hooks/useSignerAddress.ts +++ b/src/hooks/useSignerAddress.ts @@ -1,11 +1,11 @@ -import { useState, useCallback, useEffect } from 'react'; -import { useIsMounted } from 'usehooks-ts'; +import { useQuery } from 'react-query'; import { useBlockNumberContext } from '~~/context'; -import { signerHasNetwork } from '~~/functions'; -import { TEthersSigner } from '~~/models'; +import { mergeDefaultUpdateOptions, processQueryOptions, providerKey } from '~~/functions'; +import { useEthersUpdater } from '~~/hooks/useEthersUpdater'; +import { keyNamespace, TEthersSigner, THookResult, TUpdateOptions } from '~~/models'; -// / const queryKey = { namespace: keyNamespace.signer, key: 'useSignerAddress' } as const; +const queryKey = { namespace: keyNamespace.signer, key: 'useSignerAddress' } as const; /** * #### Summary @@ -17,25 +17,26 @@ import { TEthersSigner } from '~~/models'; * @returns */ export const useSignerAddress = ( - signer: TEthersSigner | undefined -): [address: string | undefined, update: () => void] => { - const isMounted = useIsMounted(); - const blockNumber = useBlockNumberContext(); - - const [address, setAddress] = useState(); - - const update = useCallback(async (): Promise => { - if (signerHasNetwork(signer)) { - const address = await signer?.getAddress(); - if (isMounted()) { - setAddress(address); + signer: TEthersSigner | undefined, + options: TUpdateOptions = mergeDefaultUpdateOptions() +): THookResult => { + const keys = [{ ...queryKey, ...providerKey(signer) }] as const; + const { data, refetch, status } = useQuery( + keys, + async (keys): Promise => { + if (signer) { + const result = await signer.getAddress(); + return result; } + return undefined; + }, + { + ...processQueryOptions(options), } - }, [isMounted, signer]); + ); - useEffect(() => { - void update(); - }, [blockNumber, update]); + const blockNumber = useBlockNumberContext(); + useEthersUpdater(refetch, blockNumber, options); - return [address, update]; + return [data, refetch, status]; }; diff --git a/src/hooks/useSignerChainId.ts b/src/hooks/useSignerChainId.ts index 217b0a9a..c489ec1a 100644 --- a/src/hooks/useSignerChainId.ts +++ b/src/hooks/useSignerChainId.ts @@ -1,9 +1,9 @@ import { useQuery } from 'react-query'; import { useBlockNumberContext } from '~~/context'; -import { mergeDefaultUpdateOptions, providerKey, TRequiredKeys } from '~~/functions'; +import { mergeDefaultUpdateOptions, processQueryOptions, providerKey, TRequiredKeys } from '~~/functions'; import { useEthersUpdater } from '~~/hooks/useEthersUpdater'; -import { const_blockNumberInterval100, TEthersSigner, TUpdateOptions } from '~~/models'; +import { const_blockNumberInterval100, TEthersSigner, THookResult, TUpdateOptions } from '~~/models'; import { keyNamespace } from '~~/models/constants'; const queryKey: TRequiredKeys = { namespace: keyNamespace.signer, key: 'useSignerChainId' } as const; @@ -20,22 +20,24 @@ const queryKey: TRequiredKeys = { namespace: keyNamespace.signer, key: 'useSigne export const useSignerChainId = ( signer: TEthersSigner | undefined, options: TUpdateOptions = mergeDefaultUpdateOptions({ ...const_blockNumberInterval100 }) -): [address: number | undefined, update: () => void] => { +): THookResult => { + type TAsyncResult = number | undefined; const keys = [{ ...queryKey, ...providerKey(signer) }] as const; - const { data, refetch } = useQuery( + + const { data, refetch, status } = useQuery( keys, - async (keys): Promise => { + async (keys): Promise => { // const { signer } = keys.queryKey[1]; const chainId = await signer?.getChainId(); return chainId; }, { - ...options.query, + ...processQueryOptions(options), } ); const blockNumber = useBlockNumberContext(); useEthersUpdater(refetch, blockNumber, options); - return [data, refetch]; + return [data, refetch, status]; }; diff --git a/src/hooks/useTimestamp.ts b/src/hooks/useTimestamp.ts index 52f8a5a1..3913bacb 100644 --- a/src/hooks/useTimestamp.ts +++ b/src/hooks/useTimestamp.ts @@ -5,11 +5,12 @@ import { ethersOverride, mergeDefaultOverride, mergeDefaultUpdateOptions, + processQueryOptions, providerKey, TRequiredKeys, } from '~~/functions'; import { useEthersUpdater } from '~~/hooks/useEthersUpdater'; -import { TOverride, TUpdateOptions } from '~~/models'; +import { THookResult, TOverride, TUpdateOptions } from '~~/models'; import { keyNamespace } from '~~/models/constants'; const queryKey: TRequiredKeys = { namespace: keyNamespace.signer, key: 'useTimestamp' } as const; @@ -30,13 +31,13 @@ const queryKey: TRequiredKeys = { namespace: keyNamespace.signer, key: 'useTimes export const useTimestamp = ( override: TOverride = mergeDefaultOverride(), options: TUpdateOptions = mergeDefaultUpdateOptions() -): [timestamp: number, update: () => void] => { +): THookResult => { const blockNumber = useBlockNumberContext(); const ethersContext = useEthersContext(override.alternateContextKey); const { provider } = ethersOverride(ethersContext, override); const keys = [{ ...queryKey, ...providerKey(provider) }, { blockNumber }] as const; - const { data, refetch } = useQuery( + const { data, refetch, status } = useQuery( keys, async (keys): Promise => { const { blockNumber } = keys.queryKey[1]; @@ -47,11 +48,11 @@ export const useTimestamp = ( return 0; }, { - ...options.query, + ...processQueryOptions(options), } ); useEthersUpdater(refetch, blockNumber, options); - return [data ?? 0, refetch]; + return [data ?? 0, refetch, status]; }; diff --git a/src/models/contractContextTypes.ts b/src/models/contractAppContextTypes.ts similarity index 100% rename from src/models/contractContextTypes.ts rename to src/models/contractAppContextTypes.ts diff --git a/src/models/hookOptions.ts b/src/models/hookTypes.ts similarity index 53% rename from src/models/hookOptions.ts rename to src/models/hookTypes.ts index 4ed8abc2..60fd76c7 100644 --- a/src/models/hookOptions.ts +++ b/src/models/hookTypes.ts @@ -1,3 +1,5 @@ +import { QueryObserverOptions, QueryStatus } from 'react-query'; + import { TEthersAdaptor } from './ethersAppContextTypes'; import { DeepPartial } from '~~/models/utilityTypes'; @@ -7,14 +9,15 @@ import { DeepPartial } from '~~/models/utilityTypes'; */ export const const_blockNumberInterval100: DeepPartial = { blockNumberInterval: 100 }; -export type TUpdateOptions = { +export type TQueryOptions = Omit< + QueryObserverOptions, + 'refetchInterval' | 'onError' | 'onSuccess' | 'notifyOnChangeProps' | 'notifyOnChangePropsExclusions' | 'select' +>; + +export type TUpdateOptions = { blockNumberInterval: number; - query: { - refetchOnWindowFocus: boolean; - refetchOnMount: boolean; - staleTime: number; - refetchInterval: number | undefined; - }; + refetchInterval: number | undefined; + query: TQueryOptions; }; export type TOverride = { @@ -30,14 +33,16 @@ export const defaultOverride = (): TOverride => { alternateContextKey: undefined, }; }; -export const defaultUpdateOptions = (): TUpdateOptions => { +export const defaultUpdateOptions = (): TUpdateOptions => { return { blockNumberInterval: 1, + refetchInterval: undefined, query: { refetchOnWindowFocus: false, refetchOnMount: true, staleTime: 30000, - refetchInterval: undefined, }, }; }; + +export type THookResult = [result: T, update: () => void, status: QueryStatus]; diff --git a/src/models/index.ts b/src/models/index.ts index a4cad3fb..fa921f0b 100644 --- a/src/models/index.ts +++ b/src/models/index.ts @@ -1,8 +1,8 @@ export * from './constants'; -export * from './contractContextTypes'; +export * from './contractAppContextTypes'; export * from './contractTypes'; export * from './ethersAppContextTypes'; -export * from './hookOptions'; +export * from './hookTypes'; export * from './networkTypes'; export * from './providerTypes'; export * from './utilityTypes'; From 8e60ec4bde64aa4b5835830c7d33b166f39fe933 Mon Sep 17 00:00:00 2001 From: Shravan Sunder Date: Sun, 16 Jan 2022 17:22:05 -0500 Subject: [PATCH 19/21] update packages --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index e87c84c6..afb0fb6c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "eth-hooks", - "version": "4.0.8", + "version": "4.0.9", "description": "A set of hooks to turbocharge buidling", "author": "Shravan Sunder", "repository": "https://github.com/austintgriffith/eth-hooks.git", From 922d5d63bb9a1418226bea896bbd3256aef0e0e1 Mon Sep 17 00:00:00 2001 From: Shravan Sunder Date: Sun, 16 Jan 2022 17:35:38 -0500 Subject: [PATCH 20/21] updated tests #126 --- test/useBalance.test.ts | 2 +- test/useBlockNumber.test.ts | 32 +++++++++++--------------------- 2 files changed, 12 insertions(+), 22 deletions(-) diff --git a/test/useBalance.test.ts b/test/useBalance.test.ts index a8ccb9d0..9b5d05ff 100644 --- a/test/useBalance.test.ts +++ b/test/useBalance.test.ts @@ -38,7 +38,7 @@ describe('useBalance', function () { // ).to.changeEtherBalances([wallet], [fromEther(-1)]); - await harness.waitForNextUpdate(defaultBlockWaitOptions); + await harness.waitForValueToChange(() => harness.result.current[0], defaultBlockWaitOptions); const newBalance = await wallet.getBalance(); const [result, updateResult] = harness.result.current; expect(result).to.equal(newBalance); diff --git a/test/useBlockNumber.test.ts b/test/useBlockNumber.test.ts index 5a6dca66..930477cd 100644 --- a/test/useBlockNumber.test.ts +++ b/test/useBlockNumber.test.ts @@ -19,41 +19,31 @@ describe('useBlockNumber', function () { testStartBockNumber = await currentTestBlockNumber(); }); - it.skip('When the hook called without a new block arriving, useBlockNumber gets the current blockNumber', async () => { - const harness = await hookTestWrapper(() => useBlockNumber(provider)); - expect(await harness.mockProvider.getBlockNumber()).to.exist; - await harness.waitForNextUpdate(defaultBlockWaitOptions); - const [result, updateResult] = harness.result.current; - expect(result).to.equal(testStartBockNumber); - }); - it('When the a new block arrives, useBlockNumberContext updates to the latest value', async () => { const harness = await hookTestWrapper(() => useBlockNumber(provider)); // mine a block await mineBlock(harness.mockProvider); - await harness.waitForNextUpdate(defaultBlockWaitOptions); + await harness.waitForValueToChange(() => harness.result.current[0], defaultBlockWaitOptions); expect(await harness.mockProvider.getBlockNumber()).to.equal(testStartBockNumber + 1); const [result1, updateResult1] = harness.result.current; expect(result1).equal(testStartBockNumber + 1); // mine another block await mineBlock(harness.mockProvider); - await harness.waitForNextUpdate(defaultBlockWaitOptions); + await harness.waitForValueToChange(() => harness.result.current[0], defaultBlockWaitOptions); const [result2, updateResult2] = harness.result.current; expect(result2).equal(testStartBockNumber + 2); expect(await harness.mockProvider.getBlockNumber()).to.equal(testStartBockNumber + 2); }); - // describe('Given when polling', function () { - // it('When a new block arrives, useBlockNumberContext updates to the latest value', async () => { - // const harness = await hookTestWrapper(() => useBlockNumber(provider, 12000)); - - // // mine a block - // await mineBlock(harness.mockProvider); - // await harness.waitForNextUpdate({ ...defaultBlockWaitOptions, timeout: 20000 }); - // expect(await harness.mockProvider.getBlockNumber()).to.equal(testStartBockNumber + 1); - // expect(harness.result.current).equal(testStartBockNumber + 1); - // }); - // }); + it('When the hook called without a new block arriving, useBlockNumber gets the current blockNumber', async () => { + const harness = await hookTestWrapper(() => useBlockNumber(provider)); + + const blockNumber = await harness.mockProvider.getBlockNumber(); + await harness.waitFor(() => harness.result.current[0] === blockNumber, defaultBlockWaitOptions); + + const [result, updateResult] = harness.result.current; + expect(result).to.equal(testStartBockNumber); + }); }); From e96e1ce67cc9b3e765a346cd905857ea67022bfc Mon Sep 17 00:00:00 2001 From: Shravan Sunder Date: Sun, 16 Jan 2022 18:04:17 -0500 Subject: [PATCH 21/21] #125 merged with #126 --- .gitignore | 1 + package.json | 2 +- .../app-contracts/contractsContextFactory.tsx | 1 + src/hooks/useBlockNumber.ts | 1 + src/hooks/useEventListener.ts | 2 +- src/hooks/useSignerChainId.ts | 2 +- src/models/contractAppContextTypes.ts | 70 ++++++++++--------- src/models/hookTypes.ts | 63 ++++++++++++++++- 8 files changed, 103 insertions(+), 39 deletions(-) diff --git a/.gitignore b/.gitignore index 9c07c1eb..00bfc393 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,4 @@ test/testresult.xml testresult.xml .yarn/install-state.gz test-files/__mocks__/generated +.DS_Store diff --git a/package.json b/package.json index 6ebc182c..879620da 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "eth-hooks", - "version": "4.0.9", + "version": "4.0.10", "description": "A set of hooks to turbocharge buidling", "author": "Shravan Sunder", "repository": "https://github.com/austintgriffith/eth-hooks.git", diff --git a/src/context/app-contracts/contractsContextFactory.tsx b/src/context/app-contracts/contractsContextFactory.tsx index 2019014f..693bcaba 100644 --- a/src/context/app-contracts/contractsContextFactory.tsx +++ b/src/context/app-contracts/contractsContextFactory.tsx @@ -17,6 +17,7 @@ import { useEthersContext } from '~~/context'; import { invalidateCache, isValidEthersAdaptor } from '~~/functions'; import { TAppContractsContext, + TBaseContractExtended, TConnectorList, TContractConnector, TContractsByChainId, diff --git a/src/hooks/useBlockNumber.ts b/src/hooks/useBlockNumber.ts index 5b99a8dc..79934c4c 100644 --- a/src/hooks/useBlockNumber.ts +++ b/src/hooks/useBlockNumber.ts @@ -1,4 +1,5 @@ import { useEffect } from 'react'; +import { useQuery } from 'react-query'; import { mergeDefaultUpdateOptions, processQueryOptions, providerKey, TRequiredKeys } from '~~/functions'; import { keyNamespace, TEthersProvider, THookResult, TUpdateOptions } from '~~/models'; diff --git a/src/hooks/useEventListener.ts b/src/hooks/useEventListener.ts index 3471c398..9665f9b4 100644 --- a/src/hooks/useEventListener.ts +++ b/src/hooks/useEventListener.ts @@ -4,7 +4,7 @@ import { useEffect } from 'react'; import { useQuery } from 'react-query'; import { contractKey, mergeDefaultUpdateOptions, processQueryOptions, TRequiredKeys } from '~~/functions'; -import { const_blockNumberInterval100, TUpdateOptions, TypedEvent } from '~~/models'; +import { const_blockNumberIntervalMedium, THookResult, TUpdateOptions, TypedEvent } from '~~/models'; import { keyNamespace } from '~~/models/constants'; const queryKey: TRequiredKeys = { namespace: keyNamespace.contracts, key: 'useEventListener' } as const; diff --git a/src/hooks/useSignerChainId.ts b/src/hooks/useSignerChainId.ts index a66f805c..7f3bfb4f 100644 --- a/src/hooks/useSignerChainId.ts +++ b/src/hooks/useSignerChainId.ts @@ -3,7 +3,7 @@ import { useQuery } from 'react-query'; import { useBlockNumberContext } from '~~/context'; import { mergeDefaultUpdateOptions, processQueryOptions, providerKey, TRequiredKeys } from '~~/functions'; import { useEthersUpdater } from '~~/hooks/useEthersUpdater'; -import { const_blockNumberInterval100, TEthersSigner, TUpdateOptions } from '~~/models'; +import { const_blockNumberIntervalMedium, TEthersSigner, THookResult, TUpdateOptions } from '~~/models'; import { keyNamespace } from '~~/models/constants'; const queryKey: TRequiredKeys = { namespace: keyNamespace.signer, key: 'useSignerChainId' } as const; diff --git a/src/models/contractAppContextTypes.ts b/src/models/contractAppContextTypes.ts index 407ea580..ceb42ed8 100644 --- a/src/models/contractAppContextTypes.ts +++ b/src/models/contractAppContextTypes.ts @@ -1,30 +1,37 @@ + import { Provider } from '@ethersproject/providers'; -import { BaseContract, ethers, Signer } from 'ethers'; +import { BaseContract, Signer } from 'ethers'; export type TConnectorConnectorBase< - GContract extends BaseContract, - GContractInterface extends ethers.utils.Interface + GContract extends BaseContract + // GContractInterface extends ethers.utils.Interface > = { connect: (address: string, signerOrProvider: Signer | Provider) => GContract; - createInterface: () => GContractInterface; + // createInterface: () => GContractInterface; abi: Record[]; }; export type TContractConnector< GContractNames extends string, - GContract extends BaseContract, - GContractInterface extends ethers.utils.Interface + GContract extends BaseContract + // GContractInterface extends ethers.utils.Interface > = { contractName: GContractNames; config: { [chainId: number]: { address: string }; }; -} & TConnectorConnectorBase; +} & TConnectorConnectorBase; + +export type TBaseContractExtended = BaseContract & { contractName: GContractNames }; -export type TConnectorList = { - [contractName in GContactNames]: TContractConnector; +export type TConnectorList> = { + [contractName in GContractNames]: TContractConnector; }; +// export type TConnectorList = { +// [contractName in GContactNames]: TContractConnector; +// }; + export type TTypedContract< GContractNames extends string, GAppContractConnectorList @@ -32,35 +39,30 @@ export type TTypedContract< [key in GContractNames]: { connect: (address: any, signerOrProvider: any) => infer TypedContract }; } ? TypedContract - : BaseContract; + : TBaseContractExtended; -export type TContractsByName = Record< - GContractNames, - { [chainId: number]: BaseContract | undefined } ->; +export type TContractsByName< + GContractNames extends string, + GContracts extends TBaseContractExtended +> = { [contractName in GContractNames]: { [chainId in number]: GContracts | undefined } }; -export type TContractsByChainId = Record< - number, - { [contractName in GContractNames]: BaseContract | undefined } ->; +export type TContractsByChainId< + GContractNames extends string, + GContracts extends TBaseContractExtended +> = { + [chainId in number]: { + [contractName in GContractNames]: GContracts | undefined; + }; +}; /** * */ -export type TAppContractsContext = { - contractConnectors: TConnectorList; - contractsByName: TContractsByName; - contractsByChainId: TContractsByChainId; -}; -/** - * Creates a default state for the contracts context - * @returns - * @internal - */ -export const defaultAppContractsContext = (): TAppContractsContext => { - return { - contractConnectors: {} as TConnectorList, - contractsByName: {} as TContractsByName, - contractsByChainId: {} as TContractsByChainId, - }; +export type TAppContractsContext< + GContractNames extends string, + GContracts extends TBaseContractExtended +> = { + contractConnectors: TConnectorList; + contractsByName: TContractsByName; + contractsByChainId: TContractsByChainId; }; diff --git a/src/models/hookTypes.ts b/src/models/hookTypes.ts index 60fd76c7..1368a5c4 100644 --- a/src/models/hookTypes.ts +++ b/src/models/hookTypes.ts @@ -5,27 +5,81 @@ import { TEthersAdaptor } from './ethersAppContextTypes'; import { DeepPartial } from '~~/models/utilityTypes'; /** - * interval of 100 blocks + * #### Summary + * An constant for block number interval of 10 blocks */ -export const const_blockNumberInterval100: DeepPartial = { blockNumberInterval: 100 }; +export const const_blockNumberIntervalShort: DeepPartial = { blockNumberInterval: 10 }; + +/** + * #### Summary + * An constant for block number interval of 50 blocks + */ +export const const_blockNumberIntervalMedium: DeepPartial = { blockNumberInterval: 50 }; + +/** + * #### Summary + * An constant for block number interval of 250 blocks + */ +export const const_blockNumberIntervalLong: DeepPartial = { blockNumberInterval: 250 }; export type TQueryOptions = Omit< QueryObserverOptions, 'refetchInterval' | 'onError' | 'onSuccess' | 'notifyOnChangeProps' | 'notifyOnChangePropsExclusions' | 'select' >; +/** + * #### Summary + * Options for hooks that describe the behviour of updates. + * By default, depending on the hook, it will update every block. + * + * ##### ✏️ Notes + * The following options are available: + * - interval: interval in blocknumber to update in (default 1) see {@link TUpdateOptions.blockNumberInterval} + * - polling: in ms, should be over 10000ms. This is set by {@link TUpdateOptions.query.refetchInterval} + */ export type TUpdateOptions = { + /** + * The interval in blocknumber for the hook to update in (default 1) + */ blockNumberInterval: number; refetchInterval: number | undefined; query: TQueryOptions; }; +/** + * #### Summary + * Ethers Provider options. By default, the context provider is used by the hook. If you want to use a different provider, you can: + * - pass in an {@link TEthersAdaptor} to override the provider + * - give the alternateContextKey for a secondary context provider. + * + * ##### ✏️ Notes + * Adaptor + * - To create a adaptor from a provider/signer see {@link useGetEthersAdaptorFromSignerOrProvider} + * - You need to set adaptorEnabled to true + * + * Alternate Context Key + * - For more info on alternateContextKey, see {@link TEthersAppContextProps} and [web3-react docs](https://github.com/NoahZinsmeister/web3-react/tree/v6/docs#createweb3reactroot). + */ export type TOverride = { + /** + * An enable override adaptor (ethers provider) for this hook + */ adaptorEnabled: boolean; + /** + * The alternate adaptor to use. See {@link TEthersAdaptor} + */ adaptor: TEthersAdaptor | undefined; + + /** + * The alternate context key to use. See {@link TEthersAppContextProps} + */ alternateContextKey?: string; }; +/** + * An helper to create the default override settings for hooks + * @returns {TOverride} + */ export const defaultOverride = (): TOverride => { return { adaptorEnabled: false, @@ -33,6 +87,11 @@ export const defaultOverride = (): TOverride => { alternateContextKey: undefined, }; }; + +/** + * A helper to create default update options for hooks + * @returns {TUpdateOptions} + */ export const defaultUpdateOptions = (): TUpdateOptions => { return { blockNumberInterval: 1,