Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
frontend
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
vicotor
frontend
Commits
54cae6f5
Commit
54cae6f5
authored
Mar 20, 2023
by
tom
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tests
parent
ecd41ca9
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
157 additions
and
3 deletions
+157
-3
state.ts
mocks/txs/state.ts
+116
-0
txStateChanges.ts
types/api/txStateChanges.ts
+0
-1
TxState.pw.tsx
ui/tx/TxState.pw.tsx
+37
-0
TxState.pw.tsx_default_base-view-mobile-1.png
...reenshots__/TxState.pw.tsx_default_base-view-mobile-1.png
+0
-0
TxState.pw.tsx_mobile_base-view-mobile-1.png
...creenshots__/TxState.pw.tsx_mobile_base-view-mobile-1.png
+0
-0
utils.tsx
ui/tx/state/utils.tsx
+4
-2
No files found.
mocks/txs/state.ts
0 → 100644
View file @
54cae6f5
import
type
{
TxStateChange
}
from
'
types/api/txStateChanges
'
;
export
const
mintToken
:
TxStateChange
=
{
address
:
{
hash
:
'
0x0000000000000000000000000000000000000000
'
,
implementation_name
:
null
,
is_contract
:
false
,
is_verified
:
false
,
name
:
null
,
private_tags
:
[],
public_tags
:
[],
watchlist_names
:
[],
},
balance_after
:
null
,
balance_before
:
null
,
change
:
[
{
direction
:
'
from
'
,
total
:
{
token_id
:
'
15077554365819457090226168288698582604878106156134383525616269766016907608065
'
,
},
},
],
is_miner
:
false
,
token
:
{
address
:
'
0x8977EA6C55e878125d1bF3433EBf72138B7a4543
'
,
decimals
:
null
,
exchange_rate
:
null
,
holders
:
'
9191
'
,
name
:
'
ParaSpace Derivative Token MOONBIRD
'
,
symbol
:
'
nMOONBIRD
'
,
total_supply
:
'
10645
'
,
type
:
'
ERC-721
'
,
},
type
:
'
token
'
,
};
export
const
receiveMintedToken
:
TxStateChange
=
{
address
:
{
hash
:
'
0xC8F71D0ae51AfBdB009E2eC1Ea8CC9Ee204A42B5
'
,
implementation_name
:
null
,
is_contract
:
false
,
is_verified
:
false
,
name
:
null
,
private_tags
:
[],
public_tags
:
[],
watchlist_names
:
[],
},
balance_after
:
'
1
'
,
balance_before
:
'
0
'
,
change
:
[
{
direction
:
'
to
'
,
total
:
{
token_id
:
'
15077554365819457090226168288698582604878106156134383525616269766016907608065
'
,
},
},
],
is_miner
:
false
,
token
:
{
address
:
'
0x8977EA6C55e878125d1bF3433EBf72138B7a4543
'
,
decimals
:
null
,
exchange_rate
:
null
,
holders
:
'
9191
'
,
name
:
'
ParaSpace Derivative Token MOONBIRD
'
,
symbol
:
'
nMOONBIRD
'
,
total_supply
:
'
10645
'
,
type
:
'
ERC-721
'
,
},
type
:
'
token
'
,
};
export
const
receiveCoin
:
TxStateChange
=
{
address
:
{
hash
:
'
0x8dC847Af872947Ac18d5d63fA646EB65d4D99560
'
,
implementation_name
:
null
,
is_contract
:
false
,
is_verified
:
null
,
name
:
null
,
private_tags
:
[],
public_tags
:
[],
watchlist_names
:
[],
},
balance_after
:
'
443787514723917012805
'
,
balance_before
:
'
443787484997510408745
'
,
change
:
'
29726406604060
'
,
is_miner
:
true
,
token
:
null
,
type
:
'
coin
'
,
};
export
const
sendCoin
:
TxStateChange
=
{
address
:
{
hash
:
'
0xC8F71D0ae51AfBdB009E2eC1Ea8CC9Ee204A42B5
'
,
implementation_name
:
null
,
is_contract
:
false
,
is_verified
:
null
,
name
:
null
,
private_tags
:
[],
public_tags
:
[],
watchlist_names
:
[],
},
balance_after
:
'
828282622733717191
'
,
balance_before
:
'
832127467556437753
'
,
change
:
'
-3844844822720562
'
,
is_miner
:
false
,
token
:
null
,
type
:
'
coin
'
,
};
export
const
baseResponse
=
[
mintToken
,
receiveMintedToken
,
sendCoin
,
receiveCoin
,
];
types/api/txStateChanges.ts
View file @
54cae6f5
...
@@ -7,7 +7,6 @@ export type TxStateChange = (TxStateChangeCoin | TxStateChangeToken) & {
...
@@ -7,7 +7,6 @@ export type TxStateChange = (TxStateChangeCoin | TxStateChangeToken) & {
is_miner
:
boolean
;
is_miner
:
boolean
;
balance_before
:
string
|
null
;
balance_before
:
string
|
null
;
balance_after
:
string
|
null
;
balance_after
:
string
|
null
;
storage
:
Array
<
unknown
>
|
null
;
}
}
export
interface
TxStateChangeCoin
{
export
interface
TxStateChangeCoin
{
...
...
ui/tx/TxState.pw.tsx
0 → 100644
View file @
54cae6f5
import
{
test
,
expect
}
from
'
@playwright/experimental-ct-react
'
;
import
React
from
'
react
'
;
import
*
as
txStateMock
from
'
mocks/txs/state
'
;
import
*
as
txMock
from
'
mocks/txs/tx
'
;
import
TestApp
from
'
playwright/TestApp
'
;
import
buildApiUrl
from
'
playwright/utils/buildApiUrl
'
;
import
TxState
from
'
./TxState
'
;
const
TX_INFO_API_URL
=
buildApiUrl
(
'
tx
'
,
{
hash
:
txMock
.
base
.
hash
});
const
TX_STATE_API_URL
=
buildApiUrl
(
'
tx_state_changes
'
,
{
hash
:
txMock
.
base
.
hash
});
const
hooksConfig
=
{
router
:
{
query
:
{
hash
:
txMock
.
base
.
hash
},
},
};
test
(
'
base view +@mobile
'
,
async
({
mount
,
page
})
=>
{
await
page
.
route
(
TX_INFO_API_URL
,
(
route
)
=>
route
.
fulfill
({
status
:
200
,
body
:
JSON
.
stringify
(
txMock
.
base
),
}));
await
page
.
route
(
TX_STATE_API_URL
,
(
route
)
=>
route
.
fulfill
({
status
:
200
,
body
:
JSON
.
stringify
(
txStateMock
.
baseResponse
),
}));
const
component
=
await
mount
(
<
TestApp
>
<
TxState
/>
</
TestApp
>,
{
hooksConfig
},
);
await
expect
(
component
).
toHaveScreenshot
();
});
ui/tx/__screenshots__/TxState.pw.tsx_default_base-view-mobile-1.png
0 → 100644
View file @
54cae6f5
41 KB
ui/tx/__screenshots__/TxState.pw.tsx_mobile_base-view-mobile-1.png
0 → 100644
View file @
54cae6f5
57.5 KB
ui/tx/state/utils.tsx
View file @
54cae6f5
...
@@ -70,9 +70,11 @@ export function getStateElements(data: TxStateChange) {
...
@@ -70,9 +70,11 @@ export function getStateElements(data: TxStateChange) {
if
(
changeDirection
)
{
if
(
changeDirection
)
{
return
(
return
(
<
Box
color=
{
changeDirection
===
'
from
'
?
'
green.500
'
:
'
red.500
'
}
>
<
Flex
color=
{
changeDirection
===
'
from
'
?
'
green.500
'
:
'
red.500
'
}
justifyContent=
{
{
base
:
'
flex-start
'
,
lg
:
'
flex-end
'
}
}
>
{
changeDirection
===
'
from
'
?
'
Mint
'
:
'
Burn
'
}
{
changeDirection
===
'
from
'
?
'
Mint
'
:
'
Burn
'
}
</
Box
>
{
nbsp
}
{
tokenLink
}
</
Flex
>
);
);
}
}
}
}
...
...
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