Commit 81fad454 authored by MigueKun's avatar MigueKun

Initial upload...

parent f9509e7b

Too many changes to show.

To preserve performance only 1000 of 1000+ files are displayed.

This diff is collapsed.
This diff is collapsed.
# Upgrading Guide
### Migration scripts
There is in the project a `scripts` folder that contains `SQL` files responsible to migrate data from the database.
This script should be used if you already have an indexed database with a large amount of data.
#### `address_current_token_balances_in_batches.sql`
Is responsible to populate a new table using the `token_balances` table information.
#### `internal_transaction_update_in_batches.sql`
Is responsible to migrate data from the `transactions` table to the `internal_transactions` one in order to improve the application listing performance;
#### `transaction_update_in_baches.sql`
Parity call traces contain the input, but it was not put in the internal_transactions_params.
Enforce input and call_type being non-NULL for calls in new constraints on internal_transactions.
[
verbose: false,
private: true,
skip: false,
router: "lib/block_scout_web/router.ex",
exit: "low",
format: "compact",
ignore: ["Config.Headers"]
]
{
"extends": "standard",
"env": {
"browser": true
}
}
# Javascript structure files
## lib
* This folder is used to place `component` files, that may span in multiple pages.
## pages
* This folder is used to place `page` specific files, that won't be reusable in other locations.
export default {
primary: "#4786ff",
secondary: "#ced4da"
}
import { asyncReducer, asyncInitialState } from '../../js/lib/async_listing_load'
describe('ELEMENTS_LOAD', () => {
test('sets only nextPagePath and ignores other keys', () => {
const state = Object.assign({}, asyncInitialState)
const action = { type: 'ELEMENTS_LOAD', nextPagePath: 'set', foo: 1 }
const output = asyncReducer(state, action)
expect(output.foo).not.toEqual(1)
expect(output.nextPagePath).toEqual('set')
})
})
describe('ADD_ITEM_KEY', () => {
test('sets itemKey to what was passed in the action', () => {
const expectedItemKey = 'expected.Key'
const state = Object.assign({}, asyncInitialState)
const action = { type: 'ADD_ITEM_KEY', itemKey: expectedItemKey }
const output = asyncReducer(state, action)
expect(output.itemKey).toEqual(expectedItemKey)
})
})
describe('START_REQUEST', () => {
test('sets loading status to true', () => {
const state = Object.assign({}, asyncInitialState, { loading: false })
const action = { type: 'START_REQUEST' }
const output = asyncReducer(state, action)
expect(output.loading).toEqual(true)
})
})
describe('REQUEST_ERROR', () => {
test('sets requestError to true', () => {
const state = Object.assign({}, asyncInitialState, { requestError: false })
const action = { type: 'REQUEST_ERROR' }
const output = asyncReducer(state, action)
expect(output.requestError).toEqual(true)
})
})
describe('FINISH_REQUEST', () => {
test('sets loading status to false', () => {
const state = Object.assign({}, asyncInitialState, {
loading: true,
loadingFirstPage: true
})
const action = { type: 'FINISH_REQUEST' }
const output = asyncReducer(state, action)
expect(output.loading).toEqual(false)
expect(output.loadingFirstPage).toEqual(false)
})
})
describe('ITEMS_FETCHED', () => {
test('sets the items to what was passed in the action', () => {
const expectedItems = [1, 2, 3]
const state = Object.assign({}, asyncInitialState)
const action = { type: 'ITEMS_FETCHED', items: expectedItems }
const output = asyncReducer(state, action)
expect(output.items).toEqual(expectedItems)
})
})
describe('NAVIGATE_TO_OLDER', () => {
test('sets beyondPageOne to true', () => {
const state = Object.assign({}, asyncInitialState, { beyondPageOne: false })
const action = { type: 'NAVIGATE_TO_OLDER' }
const output = asyncReducer(state, action)
expect(output.beyondPageOne).toEqual(true)
})
})
import { formatUsdValue } from '../../js/lib/currency'
test('formatUsdValue', () => {
window.localized = {
'Less than': 'Less than'
}
expect(formatUsdValue(0)).toEqual('$0.000000 USD')
expect(formatUsdValue(0.0000001)).toEqual('Less than $0.000001 USD')
expect(formatUsdValue(0.123456789)).toEqual('$0.123457 USD')
expect(formatUsdValue(0.1234)).toEqual('$0.123400 USD')
expect(formatUsdValue(1.23456789)).toEqual('$1.23 USD')
expect(formatUsdValue(1.2)).toEqual('$1.20 USD')
expect(formatUsdValue(123456.789)).toEqual('$123,457 USD')
})
import { reducer, initialState } from '../../js/pages/address'
describe('RECEIVED_NEW_BLOCK', () => {
test('increases validation count', () => {
const state = Object.assign({}, initialState, { validationCount: 30 })
const action = {
type: 'RECEIVED_NEW_BLOCK',
blockHtml: 'test 2'
}
const output = reducer(state, action)
expect(output.validationCount).toEqual(31)
})
test('when channel has been disconnected does not increase validation count', () => {
const state = Object.assign({}, initialState, {
channelDisconnected: true,
validationCount: 30
})
const action = {
type: 'RECEIVED_NEW_BLOCK',
blockHtml: 'test 2'
}
const output = reducer(state, action)
expect(output.validationCount).toEqual(30)
})
})
describe('RECEIVED_NEW_TRANSACTION', () => {
test('increment the transactions count', () => {
const state = Object.assign({}, initialState, {
addressHash: "0x001",
transactionCount: 1
})
const action = {
type: 'RECEIVED_NEW_TRANSACTION',
msg: { fromAddressHash: "0x001", transactionHash: 2, transactionHtml: 'test 2' }
}
const newState = reducer(state, action)
expect(newState.transactionCount).toEqual(2)
})
test('does not increment the count if the channel is disconnected', () => {
const state = Object.assign({}, initialState, {
addressHash: "0x001",
transactionCount: 1,