Module: Helpers
Pure functions in eth-hooks
Helpers
asyncSome
▸ asyncSome<T
>(arr
, predicate
): Promise
<undefined
| T
>
Summary
js .some function that can be used with async predicates
Type parameters
Name |
---|
T |
Parameters
Name | Type |
---|---|
arr | T [] |
predicate | (item : T ) => Promise <boolean > |
Returns
Promise
<undefined
| T
>
Defined in
src/functions/asyncHelpers.ts:11
isEthersProvider
▸ isEthersProvider(providerBase
): boolean
Summary
Is it a ethers compatable provider, used by EthersModalConnector and useEthersProvider
Parameters
Name | Type |
---|---|
providerBase | unknown |
Returns
boolean
Defined in
src/functions/ethersHelpers.ts:23
parseProviderOrSigner
▸ parseProviderOrSigner(providerOrSigner
): Promise
<undefined
| Readonly
<TEthersAdaptor
>>
Summary
Parse TEthersProviderOrSigner to TEthersUser Get the TEthersUser from a provider or signer
Parameters
Name | Type | Description |
---|---|---|
providerOrSigner | undefined | TEthersProviderOrSigner | TEthersProviderOrSigner |
Returns
Promise
<undefined
| Readonly
<TEthersAdaptor
>>
TProviderAndSigner
Defined in
src/functions/parseProviderOrSigner.ts:62
Misc
asyncForEach
▸ asyncForEach<T
>(array
, callback
): Promise
<void
>
Type parameters
Name |
---|
T |
Parameters
Name | Type |
---|---|
array | T [] |
callback | (item : T , index : number ) => Promise <void > |
Returns
Promise
<void
>
Defined in
src/functions/asyncHelpers.ts:18
signerHasNetwork
▸ signerHasNetwork(signer
): boolean
Parameters
Name | Type |
---|---|
signer | undefined | Signer |
Returns
boolean
Defined in
src/functions/ethersHelpers.ts:35
asEthersAdaptor
▸ asEthersAdaptor(ethersContext
): Readonly
<TEthersAdaptor
>
Parameters
Name | Type |
---|---|
ethersContext | IEthersContext |
Returns
Readonly
<TEthersAdaptor
>
Defined in
src/functions/ethersHelpers.ts:42
isValidEthersContext
▸ isValidEthersContext(ethersContext
): boolean
Parameters
Name | Type |
---|---|
ethersContext | undefined | IEthersContext |
Returns
boolean
Defined in
src/functions/ethersHelpers.ts:51
isValidEthersAdaptor
▸ isValidEthersAdaptor(ethersAdaptor
): boolean
Parameters
Name | Type |
---|---|
ethersAdaptor | undefined | TEthersAdaptor |
Returns
boolean
Defined in
src/functions/ethersHelpers.ts:63
isAdaptorEqual
▸ isAdaptorEqual(adaptor1
, adaptor2
): boolean
Parameters
Name | Type |
---|---|
adaptor1 | undefined | TEthersAdaptor |
adaptor2 | undefined | TEthersAdaptor |
Returns
boolean
Defined in
src/functions/ethersHelpers.ts:80
ethersOverride
▸ ethersOverride(context
, options
): Readonly
<TEthersAdaptor
>
Parameters
Name | Type |
---|---|
context | IEthersContext |
options | TOverride |
Returns
Readonly
<TEthersAdaptor
>
Defined in
src/functions/hookHelpers.ts:17
checkUpdateOptions
▸ checkUpdateOptions(update
): void
Summary
Hook that will verify update options are valid
Parameters
Name | Type | Description |
---|---|---|
update | TUpdateOptions <any > | Options for updating to be verified |
Returns
void
Defined in
src/functions/hookHelpers.ts:37
mergeDefaultOverride
▸ mergeDefaultOverride(...overrides
): TOverride
Parameters
Name | Type |
---|---|
...overrides | DeepPartial <TOverride >[] |
Returns
Defined in
src/functions/hookHelpers.ts:55
mergeDefaultUpdateOptions
▸ mergeDefaultUpdateOptions<GResult
>(...overrides
): TUpdateOptions
<GResult
>
Type parameters
Name | Type |
---|---|
GResult | any |
Parameters
Name | Type |
---|---|
...overrides | DeepPartial <TUpdateOptions <GResult >>[] |
Returns
TUpdateOptions
<GResult
>
Defined in
src/functions/hookHelpers.ts:65
setContextOverride
▸ setContextOverride(adaptor
, enabled?
): TOverride
Parameters
Name | Type | Default value |
---|---|---|
adaptor | undefined | TEthersAdaptor | undefined |
enabled | boolean | true |
Returns
Defined in
src/functions/hookHelpers.ts:83
processQueryOptions
▸ processQueryOptions<GResult
>(options
): Omit
<QueryObserverOptions
<GResult
, any
, GResult
, GResult
, QueryKey
>, "refetchInterval"
| "notifyOnChangeProps"
| "notifyOnChangePropsExclusions"
| "useErrorBoundary"
| "refetchOnWindowFocus"
| "refetchOnMount"
| "refetchOnReconnect"
> & { refetchOnWindowFocus?
: boolean
| "always"
; refetchOnMount?
: boolean
| "always"
; refetchOnReconnect?
: boolean
| "always"
} & { refetchInterval?
: number
}
Type parameters
Name |
---|
GResult |
Parameters
Name | Type |
---|---|
options | TUpdateOptions <GResult > |
Returns
Omit
<QueryObserverOptions
<GResult
, any
, GResult
, GResult
, QueryKey
>, "refetchInterval"
| "notifyOnChangeProps"
| "notifyOnChangePropsExclusions"
| "useErrorBoundary"
| "refetchOnWindowFocus"
| "refetchOnMount"
| "refetchOnReconnect"
> & { refetchOnWindowFocus?
: boolean
| "always"
; refetchOnMount?
: boolean
| "always"
; refetchOnReconnect?
: boolean
| "always"
} & { refetchInterval?
: number
}
Defined in
src/functions/hookHelpers.ts:87
TRequiredKeys
Ƭ TRequiredKeys: Object
Type declaration
Name | Type |
---|---|
namespace | string |
key | string |
Defined in
src/functions/keyHelpers.ts:10
TKeyTypes
Ƭ TKeyTypes: Object
Type declaration
Name | Type |
---|---|
provider? | string |
adaptor? | string |
contract? | string |
contractFunc? | string |
Defined in
src/functions/keyHelpers.ts:15
providerKey
▸ providerKey(providerOrSigner
): Record
<"signer"
| "provider"
, string
>
Get a react-query query key fo ethers provider
Parameters
Name | Type |
---|---|
providerOrSigner | undefined | TEthersProviderOrSigner |
Returns
Record
<"signer"
| "provider"
, string
>
Defined in
src/functions/keyHelpers.ts:27
adaptorKey
▸ adaptorKey(adaptor
): Partial
<Record
<"provider"
| "adaptor"
, string
>>
Get a react-query query key
Parameters
Name | Type |
---|---|
adaptor | undefined | TEthersAdaptor |
Returns
Partial
<Record
<"provider"
| "adaptor"
, string
>>
Defined in
src/functions/keyHelpers.ts:62
eventKey
▸ eventKey(m
): string
Get a react-query query key
Parameters
Name | Type |
---|---|
m | Event | TypedEvent <Result > |
Returns
string
Defined in
src/functions/keyHelpers.ts:79
contractKey
▸ contractKey(contract
): Partial
<Record
<"provider"
| "contract"
, string
>>
Get a react-query query key
Parameters
Name | Type |
---|---|
contract | undefined | BaseContract |
Returns
Partial
<Record
<"provider"
| "contract"
, string
>>
Defined in
src/functions/keyHelpers.ts:88
contractFuncKey
▸ contractFuncKey(contract
, func
): Record
<"contractFunc"
, string
>
Get a react-query query key
Parameters
Name | Type |
---|---|
contract | undefined | BaseContract |
func | undefined | (...args : any []) => Promise <any > |
Returns
Record
<"contractFunc"
, string
>
Defined in
src/functions/keyHelpers.ts:115
invalidateCache
▸ invalidateCache(queryClient
, namespace
, otherKeys?
, variables?
): void
Parameters
Name | Type |
---|---|
queryClient | QueryClient |
namespace | string |
otherKeys | TKeyTypes & { key? : string } |
variables | Record <string , any > |
Returns
void
Defined in
src/functions/keyHelpers.ts:135
logQueryCache
▸ logQueryCache(queryClient
, namespace
, otherKeys?
, variables?
): void
Parameters
Name | Type |
---|---|
queryClient | QueryClient |
namespace | string |
otherKeys | TKeyTypes & { key? : string } |
variables | Record <string , any > |
Returns
void
Defined in
src/functions/keyHelpers.ts:144
isProvider
▸ isProvider(providerOrSigner
): boolean
Parameters
Name | Type |
---|---|
providerOrSigner | undefined | TEthersProviderOrSigner |
Returns
boolean