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
287f64cf
Unverified
Commit
287f64cf
authored
May 13, 2020
by
Moody Salem
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix a redux error from passing a BigNumber to the store
parent
822f9e5f
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
8 deletions
+34
-8
actions.ts
src/state/transactions/actions.ts
+16
-4
hooks.tsx
src/state/transactions/hooks.tsx
+16
-1
reducer.ts
src/state/transactions/reducer.ts
+2
-3
No files found.
src/state/transactions/actions.ts
View file @
287f64cf
import
{
TransactionReceipt
}
from
'
@ethersproject/providers
'
import
{
createAction
}
from
'
@reduxjs/toolkit
'
import
{
createAction
}
from
'
@reduxjs/toolkit
'
export
interface
SerializableTransactionReceipt
{
to
:
string
from
:
string
contractAddress
:
string
transactionIndex
:
number
blockHash
:
string
transactionHash
:
string
blockNumber
:
number
status
?:
number
}
export
const
addTransaction
=
createAction
<
{
export
const
addTransaction
=
createAction
<
{
chainId
:
number
chainId
:
number
hash
:
string
hash
:
string
...
@@ -8,6 +18,8 @@ export const addTransaction = createAction<{
...
@@ -8,6 +18,8 @@ export const addTransaction = createAction<{
summary
?:
string
summary
?:
string
}
>
(
'
addTransaction
'
)
}
>
(
'
addTransaction
'
)
export
const
checkTransaction
=
createAction
<
{
chainId
:
number
;
hash
:
string
;
blockNumber
:
number
}
>
(
'
checkTransaction
'
)
export
const
checkTransaction
=
createAction
<
{
chainId
:
number
;
hash
:
string
;
blockNumber
:
number
}
>
(
'
checkTransaction
'
)
export
const
finalizeTransaction
=
createAction
<
{
chainId
:
number
;
hash
:
string
;
receipt
:
TransactionReceipt
}
>
(
export
const
finalizeTransaction
=
createAction
<
{
'
finalizeTransaction
'
chainId
:
number
)
hash
:
string
receipt
:
SerializableTransactionReceipt
}
>
(
'
finalizeTransaction
'
)
src/state/transactions/hooks.tsx
View file @
287f64cf
...
@@ -36,7 +36,22 @@ export function Updater() {
...
@@ -36,7 +36,22 @@ export function Updater() {
if
(
!
receipt
)
{
if
(
!
receipt
)
{
dispatch
(
checkTransaction
({
chainId
,
hash
,
blockNumber
:
globalBlockNumber
}))
dispatch
(
checkTransaction
({
chainId
,
hash
,
blockNumber
:
globalBlockNumber
}))
}
else
{
}
else
{
dispatch
(
finalizeTransaction
({
chainId
,
hash
,
receipt
}))
dispatch
(
finalizeTransaction
({
chainId
,
hash
,
receipt
:
{
blockHash
:
receipt
.
blockHash
,
blockNumber
:
receipt
.
blockNumber
,
contractAddress
:
receipt
.
contractAddress
,
from
:
receipt
.
from
,
status
:
receipt
.
status
,
to
:
receipt
.
to
,
transactionHash
:
receipt
.
transactionHash
,
transactionIndex
:
receipt
.
transactionIndex
}
})
)
// add success or failure popup
// add success or failure popup
if
(
receipt
.
status
===
1
)
{
if
(
receipt
.
status
===
1
)
{
addPopup
({
addPopup
({
...
...
src/state/transactions/reducer.ts
View file @
287f64cf
import
{
TransactionReceipt
}
from
'
@ethersproject/providers
'
import
{
createReducer
}
from
'
@reduxjs/toolkit
'
import
{
createReducer
}
from
'
@reduxjs/toolkit
'
import
{
addTransaction
,
checkTransaction
,
finalizeTransaction
}
from
'
./actions
'
import
{
addTransaction
,
checkTransaction
,
finalizeTransaction
,
SerializableTransactionReceipt
}
from
'
./actions
'
export
interface
TransactionDetails
{
export
interface
TransactionDetails
{
approvalOfToken
?:
string
approvalOfToken
?:
string
blockNumberChecked
?:
number
blockNumberChecked
?:
number
summary
?:
string
summary
?:
string
receipt
?:
TransactionReceipt
receipt
?:
Serializable
TransactionReceipt
}
}
export
interface
TransactionState
{
export
interface
TransactionState
{
...
...
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