-
Notifications
You must be signed in to change notification settings - Fork 370
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Wallet] Fix slow activity feed tx confirmations #2290
Changes from 8 commits
8390328
f276c08
019a73a
562c4b4
cc57d76
1386888
818b4ff
10e2411
90bf3e2
5246ec4
7802782
516a29c
c618606
a52e86a
c283318
76fd3f3
b691fb3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,93 +1,81 @@ | ||
import { | ||
EventTypeNames, | ||
HomeExchangeFragment, | ||
HomeTransferFragment, | ||
UserTransactionsData, | ||
} from 'src/apollo/types' | ||
import { HomeExchangeFragment, HomeTransferFragment, UserTransactionsData } from 'src/apollo/types' | ||
import { CURRENCY_ENUM } from 'src/geth/consts' | ||
import { SENTINEL_INVITE_COMMENT } from 'src/invite/actions' | ||
import { TransactionTypes } from 'src/transactions/reducer' | ||
import { TransactionTypes, TransferTransactionTypes } from 'src/transactions/reducer' | ||
|
||
export const invitedAddress = '0x1b173' | ||
|
||
const exchangeDollar: HomeExchangeFragment = { | ||
__typename: EventTypeNames.Exchange, | ||
type: 'EXCHANGE' as TransactionTypes, | ||
type: 'EXCHANGE' as TransactionTypes.EXCHANGE, | ||
hash: '1', | ||
inValue: 19080, | ||
timestamp: Date.now(), | ||
inSymbol: 'Celo Dollar', | ||
outSymbol: 'Celo Gold', | ||
inSymbol: 'Celo Dollar' as CURRENCY_ENUM, | ||
outSymbol: 'Celo Gold' as CURRENCY_ENUM, | ||
outValue: 62252, | ||
} | ||
|
||
const exchangeGold: HomeExchangeFragment = { | ||
__typename: EventTypeNames.Exchange, | ||
type: 'EXCHANGE' as TransactionTypes, | ||
type: 'EXCHANGE' as TransactionTypes.EXCHANGE, | ||
hash: '1', | ||
inValue: 190, | ||
timestamp: Date.now(), | ||
inSymbol: 'Celo Gold', | ||
outSymbol: 'Celo Dollar', | ||
inSymbol: 'Celo Gold' as CURRENCY_ENUM, | ||
outSymbol: 'Celo Dollar' as CURRENCY_ENUM, | ||
outValue: 62, | ||
} | ||
|
||
const sent: HomeTransferFragment = { | ||
__typename: EventTypeNames.Transfer, | ||
type: 'SENT' as TransactionTypes, | ||
type: 'SENT' as TransferTransactionTypes, | ||
value: 987161, | ||
symbol: 'Celo Gold', | ||
symbol: 'Celo Gold' as CURRENCY_ENUM, | ||
timestamp: Date.now(), | ||
address: '0x423043cca38e75d7913504fedfd1dd4539cc55b3', | ||
comment: 'FAKE FAKE FAKE', | ||
hash: '01010', | ||
} | ||
|
||
const sentInvite: HomeTransferFragment = { | ||
__typename: EventTypeNames.Transfer, | ||
type: 'SENT' as TransactionTypes, | ||
type: 'SENT' as TransferTransactionTypes, | ||
value: 0.33, | ||
symbol: 'Celo Dollar', | ||
symbol: 'Celo Dollar' as CURRENCY_ENUM, | ||
timestamp: Date.now(), | ||
address: invitedAddress, | ||
comment: SENTINEL_INVITE_COMMENT, | ||
hash: '0x1010', | ||
} | ||
|
||
const recieved: HomeTransferFragment = { | ||
__typename: EventTypeNames.Transfer, | ||
type: 'RECEIVED' as TransactionTypes, | ||
type: 'RECEIVED' as TransferTransactionTypes, | ||
value: 587161, | ||
symbol: 'Celo Gold', | ||
symbol: 'Celo Gold' as CURRENCY_ENUM, | ||
timestamp: Date.now(), | ||
address: '0x423043cca38e75d7913504fedfd1dd4539cc55b3', | ||
comment: 'FAKE FAKE FAKE', | ||
hash: '01010', | ||
} | ||
const faucet: HomeTransferFragment = { | ||
__typename: EventTypeNames.Transfer, | ||
type: 'FAUCET' as TransactionTypes, | ||
type: 'FAUCET' as TransferTransactionTypes, | ||
value: 387161, | ||
symbol: 'Celo Dollar', | ||
symbol: 'Celo Dollar' as CURRENCY_ENUM, | ||
timestamp: Date.now(), | ||
address: '0x423043cca38e75d7913504fedfd1dd4539cc55b3', | ||
comment: 'FAKE FAKE FAKE', | ||
hash: '01010', | ||
} | ||
const verificationFee: HomeTransferFragment = { | ||
__typename: EventTypeNames.Transfer, | ||
type: 'VERIFICATION_FEE' as TransactionTypes, | ||
type: 'VERIFICATION_FEE' as TransferTransactionTypes, | ||
value: 0.3, | ||
symbol: 'Celo Gold', | ||
symbol: 'Celo Gold' as CURRENCY_ENUM, | ||
timestamp: Date.now(), | ||
address: '0x423043cca38e75d7913504fedfd1dd4539cc55b3', | ||
comment: 'FAKE FAKE FAKE', | ||
hash: '01010', | ||
} | ||
const verificationReward: HomeTransferFragment = { | ||
__typename: EventTypeNames.Transfer, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why don't we need these graphQL provided __typename properties anymore? Is it cause @jeanregisser split the home feed and exchange feed queries in bc-api? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah we don't need them since we know the EventType from the transaction type |
||
type: 'VERIFICATION_REWARD' as TransactionTypes, | ||
type: 'VERIFICATION_REWARD' as TransferTransactionTypes, | ||
value: 9371, | ||
symbol: 'Celo Dollar', | ||
symbol: 'Celo Dollar' as CURRENCY_ENUM, | ||
timestamp: Date.now(), | ||
address: '0x423043cca38e75d7913504fedfd1dd4539cc55b3', | ||
comment: 'FAKE FAKE FAKE', | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,51 @@ | ||
import { Query } from 'react-apollo' | ||
import { TransactionTypes } from 'src/transactions/reducer' | ||
import { CURRENCY_ENUM } from 'src/geth/consts' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I just tried it and it doesn't work right now, but i think this file originally came from running There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Kk are you saying we should avoid modifying this generated file? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This file was originally made that way but most of that auto gen code has been changed over time. I've made modifications here too. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I believe we diverged away from the auto gen types because of the differing shapes of our standby tx and graphql txs |
||
import { | ||
TransactionStatus, | ||
TransactionTypes, | ||
TransferTransactionTypes, | ||
} from 'src/transactions/reducer' | ||
|
||
export interface UserTransactionsVariables { | ||
address: string | ||
} | ||
|
||
export enum EventTypeNames { | ||
Exchange = 'Exchange', | ||
Transfer = 'Transfer', | ||
} | ||
|
||
export interface HomeExchangeFragment { | ||
__typename: EventTypeNames.Exchange | ||
type: TransactionTypes | ||
hash: string | ||
export interface ExchangeTransaction { | ||
type: TransactionTypes.EXCHANGE | ||
id?: string | ||
hash?: string | ||
inValue: number | ||
outValue: number | ||
inSymbol: string | ||
outSymbol: string | ||
inSymbol: CURRENCY_ENUM | ||
outSymbol: CURRENCY_ENUM | ||
timestamp: number | ||
status?: TransactionStatus | ||
} | ||
|
||
export interface HomeTransferFragment { | ||
__typename: EventTypeNames.Transfer | ||
type: TransactionTypes | ||
hash: string | ||
export interface TransferTransaction { | ||
type: TransferTransactionTypes | ||
id?: string | ||
hash?: string | ||
value: number | ||
symbol: string | ||
symbol: CURRENCY_ENUM | ||
timestamp: number | ||
address: string | ||
comment: string | ||
status?: TransactionStatus | ||
// TODO: fee needs to be added here | ||
} | ||
|
||
export type Event = HomeExchangeFragment | HomeTransferFragment | ||
export interface HomeExchangeFragment extends ExchangeTransaction { | ||
hash: string | ||
} | ||
|
||
export interface HomeTransferFragment extends TransferTransaction { | ||
hash: string | ||
} | ||
|
||
export type Transaction = ExchangeTransaction | TransferTransaction | ||
export interface UserTransactionsData { | ||
events?: Event[] | null | ||
events?: Transaction[] | null | ||
} | ||
|
||
export default class UserTransactionsQuery extends Query< | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -86,7 +86,7 @@ function* registerStandbyTransaction(id: string, value: string, address: string) | |
id, | ||
type: TransactionTypes.ESCROW_SENT, | ||
status: TransactionStatus.Pending, | ||
value, | ||
value: +value, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note that storing StandbyTransaction as |
||
symbol: CURRENCY_ENUM.DOLLAR, | ||
timestamp: Math.floor(Date.now() / 1000), | ||
address, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,6 @@ import * as React from 'react' | |
import 'react-native' | ||
import { Provider } from 'react-redux' | ||
import * as renderer from 'react-test-renderer' | ||
import { EventTypeNames } from 'src/apollo/types' | ||
import { CURRENCY_ENUM } from 'src/geth/consts' | ||
import { ExchangeFeedItem } from 'src/transactions/ExchangeFeedItem' | ||
import { TransactionStatus, TransactionTypes } from 'src/transactions/reducer' | ||
|
@@ -28,8 +27,7 @@ describe('ExchangeFeedItem', () => { | |
<Provider store={createMockStore({})}> | ||
<ExchangeFeedItem | ||
status={TransactionStatus.Complete} | ||
__typename={EventTypeNames.Exchange} | ||
type={'EXCHANGE' as TransactionTypes} | ||
type={'EXCHANGE' as TransactionTypes.EXCHANGE} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same enum comment There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as above |
||
hash={'0x'} | ||
inValue={1} | ||
outValue={10} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not just use the enum's actual value? (not sure who did this originally)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is a more realistic mock of what would be returned?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think Connors point is that
TransactionTypes.Exchange
=== 'EXCHANGE' so why hardcode the value here?And I think the reason it was originally hard coded in the first place is that the auto-gen typing tool did it this way