Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
I
interface
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
LuckySwap
interface
Commits
0ab1e5f1
Unverified
Commit
0ab1e5f1
authored
Sep 08, 2021
by
Moody Salem
Committed by
GitHub
Sep 08, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: cherry pick the logs hook fix from the liquidity incentives branch (#2315)
parent
115c72db
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
1 deletion
+6
-1
hooks.ts
src/state/logs/hooks.ts
+2
-1
utils.ts
src/state/logs/utils.ts
+4
-0
No files found.
src/state/logs/hooks.ts
View file @
0ab1e5f1
...
...
@@ -5,7 +5,7 @@ import { useAppDispatch, useAppSelector } from '../hooks'
import
{
addListener
,
removeListener
}
from
'
./slice
'
import
{
EventFilter
,
filterToKey
,
Log
}
from
'
./utils
'
enum
LogsState
{
e
xport
e
num
LogsState
{
// The filter is invalid
INVALID
,
// The logs are being loaded
...
...
@@ -26,6 +26,7 @@ export interface UseLogsResult {
/**
* Returns the logs for the given filter as of the latest block, re-fetching from the library every block.
* @param filter The logs filter, without `blockHash`, `fromBlock` or `toBlock` defined.
* The filter parameter should _always_ be memoized, or else will trigger constant refetching
*/
export
function
useLogs
(
filter
:
EventFilter
|
undefined
):
UseLogsResult
{
const
{
chainId
}
=
useActiveWeb3React
()
...
...
src/state/logs/utils.ts
View file @
0ab1e5f1
...
...
@@ -6,6 +6,9 @@ export interface EventFilter {
export
interface
Log
{
topics
:
Array
<
string
>
data
:
string
transactionIndex
:
number
logIndex
:
number
blockNumber
:
number
}
/**
...
...
@@ -26,6 +29,7 @@ export function keyToFilter(key: string): EventFilter {
const pcs = key.split(':')
const address = pcs[0]
const topics = pcs[1].split('-').map((topic) => {
if (topic === '\0') return null
const parts = topic.split(';')
if (parts.length === 1) return parts[0]
return parts
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment