-
Notifications
You must be signed in to change notification settings - Fork 484
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2253 from blockscout/fe-2233
add blackfort validators
- Loading branch information
Showing
32 changed files
with
648 additions
and
91 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# Set of ENVs for BXN Testnet network explorer | ||
# https://blackfort-testnet.blockscout.com | ||
# This is an auto-generated file. To update all values, run "yarn dev:preset:sync --name=blackfort_testnet" | ||
|
||
# Local ENVs | ||
NEXT_PUBLIC_APP_PROTOCOL=http | ||
NEXT_PUBLIC_APP_HOST=localhost | ||
NEXT_PUBLIC_APP_PORT=3000 | ||
NEXT_PUBLIC_APP_ENV=development | ||
NEXT_PUBLIC_API_WEBSOCKET_PROTOCOL=ws | ||
|
||
# Instance ENVs | ||
NEXT_PUBLIC_ADMIN_SERVICE_API_HOST=https://admin-rs.services.blockscout.com | ||
NEXT_PUBLIC_API_BASE_PATH=/ | ||
NEXT_PUBLIC_API_HOST=blackfort-testnet.blockscout.com | ||
NEXT_PUBLIC_API_SPEC_URL=https://raw.githubusercontent.com/blockscout/blockscout-api-v2-swagger/main/swagger.yaml | ||
NEXT_PUBLIC_CONTRACT_CODE_IDES=[{'title':'Remix IDE','url':'https://remix.ethereum.org/?address={hash}&blockscout={domain}','icon_url':'https://raw.githubusercontent.com/blockscout/frontend-configs/main/configs/ide-icons/remix.png'}] | ||
NEXT_PUBLIC_CONTRACT_INFO_API_HOST=https://contracts-info.services.blockscout.com | ||
NEXT_PUBLIC_FEATURED_NETWORKS=https://raw.githubusercontent.com/blockscout/frontend-configs/main/configs/featured-networks/blackfort-testnet.json | ||
NEXT_PUBLIC_FOOTER_LINKS=https://raw.githubusercontent.com/blockscout/frontend-configs/main/configs/footer-links/blackfort.json | ||
NEXT_PUBLIC_GRAPHIQL_TRANSACTION=0xcb4140e22cde3412eb5aecdedf2403032c7a251f5c96b11122aca5b1b88ed953 | ||
NEXT_PUBLIC_HOMEPAGE_CHARTS=['daily_txs'] | ||
NEXT_PUBLIC_HOMEPAGE_PLATE_BACKGROUND=linear-gradient(92deg, rgb(3, 150, 254) 0.24%, rgb(36, 209, 245) 98.31%) | ||
NEXT_PUBLIC_IS_TESTNET=true | ||
NEXT_PUBLIC_MARKETPLACE_ENABLED=false | ||
NEXT_PUBLIC_METADATA_SERVICE_API_HOST=https://metadata.services.blockscout.com | ||
NEXT_PUBLIC_NETWORK_CURRENCY_DECIMALS=18 | ||
NEXT_PUBLIC_NETWORK_CURRENCY_NAME=TBXN | ||
NEXT_PUBLIC_NETWORK_CURRENCY_SYMBOL=TBXN | ||
NEXT_PUBLIC_NETWORK_ICON=https://raw.githubusercontent.com/blockscout/frontend-configs/main/configs/network-icons/blackfort.svg | ||
NEXT_PUBLIC_NETWORK_ICON_DARK=https://raw.githubusercontent.com/blockscout/frontend-configs/main/configs/network-icons/blackfort-dark.svg | ||
NEXT_PUBLIC_NETWORK_ID=4777 | ||
NEXT_PUBLIC_NETWORK_LOGO=https://raw.githubusercontent.com/blockscout/frontend-configs/main/configs/network-logos/blackfort.svg | ||
NEXT_PUBLIC_NETWORK_LOGO_DARK=https://raw.githubusercontent.com/blockscout/frontend-configs/main/configs/network-logos/blackfort-dark.svg | ||
NEXT_PUBLIC_NETWORK_NAME=BXN Testnet | ||
NEXT_PUBLIC_NETWORK_RPC_URL=https://testnet.blackfort.network/rpc | ||
NEXT_PUBLIC_NETWORK_SHORT_NAME=BXN Testnet | ||
NEXT_PUBLIC_OG_ENHANCED_DATA_ENABLED=true | ||
NEXT_PUBLIC_OG_IMAGE_URL=https://raw.githubusercontent.com/blockscout/frontend-configs/main/configs/og-images/blackfort.png | ||
NEXT_PUBLIC_STATS_API_HOST=https://stats-blackfort-testnet.k8s.blockscout.com | ||
NEXT_PUBLIC_TRANSACTION_INTERPRETATION_PROVIDER=blockscout | ||
NEXT_PUBLIC_VIEWS_CONTRACT_SOLIDITYSCAN_ENABLED=true | ||
NEXT_PUBLIC_VISUALIZE_API_HOST=https://visualizer.services.blockscout.com | ||
NEXT_PUBLIC_VALIDATORS_CHAIN_TYPE=blackfort |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import type { | ||
ValidatorBlackfort, | ||
ValidatorsBlackfortCountersResponse, | ||
ValidatorsBlackfortResponse, | ||
} from 'types/api/validators'; | ||
|
||
import * as addressMock from '../address/address'; | ||
|
||
export const validator1: ValidatorBlackfort = { | ||
address: addressMock.withName, | ||
name: 'testnet-3', | ||
commission: 10, | ||
delegated_amount: '0', | ||
self_bonded_amount: '10000', | ||
}; | ||
|
||
export const validator2: ValidatorBlackfort = { | ||
address: addressMock.withEns, | ||
name: 'GooseGanG GooseGanG GooseGanG GooseGanG GooseGanG GooseGanG GooseGanG', | ||
commission: 5000, | ||
delegated_amount: '10000', | ||
self_bonded_amount: '100', | ||
}; | ||
|
||
export const validator3: ValidatorBlackfort = { | ||
address: addressMock.withoutName, | ||
name: 'testnet-1', | ||
commission: 0, | ||
delegated_amount: '0', | ||
self_bonded_amount: '10000', | ||
}; | ||
|
||
export const validatorsResponse: ValidatorsBlackfortResponse = { | ||
items: [ validator1, validator2, validator3 ], | ||
next_page_params: null, | ||
}; | ||
|
||
export const validatorsCountersResponse: ValidatorsBlackfortCountersResponse = { | ||
new_validators_counter_24h: '11', | ||
validators_counter: '140', | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,34 @@ | ||
import type { Validator, ValidatorsCountersResponse } from 'types/api/validators'; | ||
import type { | ||
ValidatorStability, | ||
ValidatorsStabilityCountersResponse, | ||
ValidatorBlackfort, | ||
ValidatorsBlackfortCountersResponse, | ||
} from 'types/api/validators'; | ||
|
||
import { ADDRESS_PARAMS } from './addressParams'; | ||
|
||
export const VALIDATOR: Validator = { | ||
export const VALIDATOR_STABILITY: ValidatorStability = { | ||
address: ADDRESS_PARAMS, | ||
blocks_validated_count: 25987, | ||
state: 'active', | ||
}; | ||
|
||
export const VALIDATORS_COUNTERS: ValidatorsCountersResponse = { | ||
export const VALIDATORS_STABILITY_COUNTERS: ValidatorsStabilityCountersResponse = { | ||
active_validators_counter: '42', | ||
active_validators_percentage: 7.14, | ||
new_validators_counter_24h: '11', | ||
validators_counter: '140', | ||
}; | ||
|
||
export const VALIDATOR_BLACKFORT: ValidatorBlackfort = { | ||
address: ADDRESS_PARAMS, | ||
name: 'testnet-1', | ||
commission: 10, | ||
delegated_amount: '0', | ||
self_bonded_amount: '10000', | ||
}; | ||
|
||
export const VALIDATORS_BLACKFORT_COUNTERS: ValidatorsBlackfortCountersResponse = { | ||
new_validators_counter_24h: '11', | ||
validators_counter: '140', | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,67 @@ | ||
import type { AddressParam } from './addressParams'; | ||
|
||
export interface Validator { | ||
export interface ValidatorStability { | ||
address: AddressParam; | ||
blocks_validated_count: number; | ||
state: 'active' | 'probation' | 'inactive'; | ||
} | ||
|
||
export interface ValidatorsResponse { | ||
items: Array<Validator>; | ||
export interface ValidatorsStabilityResponse { | ||
items: Array<ValidatorStability>; | ||
next_page_params: { | ||
'address_hash': string; | ||
'blocks_validated': string; | ||
'items_count': string; | ||
'state': Validator['state']; | ||
'state': ValidatorStability['state']; | ||
} | null; | ||
} | ||
|
||
export interface ValidatorsCountersResponse { | ||
export interface ValidatorsStabilityCountersResponse { | ||
active_validators_counter: string; | ||
active_validators_percentage: number; | ||
new_validators_counter_24h: string; | ||
validators_counter: string; | ||
} | ||
|
||
export interface ValidatorsFilters { | ||
export interface ValidatorsStabilityFilters { | ||
// address_hash: string | undefined; // right now API doesn't support filtering by address_hash | ||
state_filter: Validator['state'] | undefined; | ||
state_filter: ValidatorStability['state'] | undefined; | ||
} | ||
|
||
export interface ValidatorsSorting { | ||
export interface ValidatorsStabilitySorting { | ||
sort: 'state' | 'blocks_validated'; | ||
order: 'asc' | 'desc'; | ||
} | ||
|
||
export type ValidatorsSortingField = ValidatorsSorting['sort']; | ||
export type ValidatorsStabilitySortingField = ValidatorsStabilitySorting['sort']; | ||
|
||
export type ValidatorsSortingValue = `${ ValidatorsSortingField }-${ ValidatorsSorting['order'] }`; | ||
export type ValidatorsStabilitySortingValue = `${ ValidatorsStabilitySortingField }-${ ValidatorsStabilitySorting['order'] }`; | ||
|
||
export interface ValidatorBlackfort { | ||
address: AddressParam; | ||
name: string; | ||
commission: number; | ||
delegated_amount: string; | ||
self_bonded_amount: string; | ||
} | ||
|
||
export interface ValidatorsBlackfortResponse { | ||
items: Array<ValidatorBlackfort>; | ||
next_page_params: { | ||
'address_hash': string; | ||
} | null; | ||
} | ||
|
||
export interface ValidatorsBlackfortCountersResponse { | ||
new_validators_counter_24h: string; | ||
validators_counter: string; | ||
} | ||
|
||
export interface ValidatorsBlackfortSorting { | ||
sort: 'address_hash'; | ||
order: 'asc' | 'desc'; | ||
} | ||
|
||
export type ValidatorsBlackfortSortingField = ValidatorsBlackfortSorting['sort']; | ||
|
||
export type ValidatorsBlackfortSortingValue = `${ ValidatorsBlackfortSortingField }-${ ValidatorsBlackfortSorting['order'] }`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import React from 'react'; | ||
|
||
import * as validatorsMock from 'mocks/validators/blackfort'; | ||
import { test, expect } from 'playwright/lib'; | ||
|
||
import Validators from './ValidatorsBlackfort'; | ||
|
||
const chainType = 'blackfort'; | ||
|
||
test('base view +@mobile', async({ render, mockApiResponse, mockEnvs, mockTextAd }) => { | ||
await mockEnvs([ | ||
[ 'NEXT_PUBLIC_VALIDATORS_CHAIN_TYPE', chainType ], | ||
]); | ||
await mockApiResponse('validators_blackfort', validatorsMock.validatorsResponse); | ||
await mockApiResponse('validators_blackfort_counters', validatorsMock.validatorsCountersResponse); | ||
await mockTextAd(); | ||
|
||
const component = await render(<Validators/>); | ||
|
||
await expect(component).toHaveScreenshot(); | ||
}); |
Oops, something went wrong.