diff --git a/package.json b/package.json index 1ed2027e..c7493eb4 100644 --- a/package.json +++ b/package.json @@ -65,9 +65,9 @@ "npm": ">=6.14.x" }, "scripts": { - "start": "REACT_APP_VERSION=$(git describe --abbrev=0) REACT_APP_GIT_SHA=$(git rev-parse --short HEAD) react-scripts start", - "serve": "REACT_APP_VERSION=$(git describe --abbrev=0) REACT_APP_GIT_SHA=$(git rev-parse --short HEAD) BROWSER=none react-scripts start", - "build": "REACT_APP_VERSION=$(git describe --abbrev=0) REACT_APP_GIT_SHA=$(git rev-parse --short HEAD) react-scripts build", + "start": "REACT_APP_VERSION=$(git describe --tags --abbrev=0) REACT_APP_GIT_SHA=$(git rev-parse --short HEAD) react-scripts start", + "serve": "REACT_APP_VERSION=$(git describe --tags --abbrev=0) REACT_APP_GIT_SHA=$(git rev-parse --short HEAD) BROWSER=none react-scripts start", + "build": "REACT_APP_VERSION=$(git describe --tags --abbrev=0) REACT_APP_GIT_SHA=$(git rev-parse --short HEAD) react-scripts build", "test": "react-scripts test", "eject": "react-scripts eject" }, diff --git a/public/locales/en/translation.json b/public/locales/en/translation.json index 39d6b0dc..30701b5b 100644 --- a/public/locales/en/translation.json +++ b/public/locales/en/translation.json @@ -124,6 +124,7 @@ "originated_account_maps": "Map Owners", "big_maps": "Map Definitons", "big_map_contents": "Map Content", + "big_map_contents_history": "Map Content History", "known_addresses": "Known Addresses", "baker_registry": "TCF Baker Registry", "bakers_history": "Baker History", @@ -344,7 +345,8 @@ "utc_year": "Year (UTC)", "utc_month": "Month (UTC)", "utc_day": "Day (UTC)", - "utc_time": "Time (UTC)" + "utc_time": "Time (UTC)", + "operation_order": "Operation Order" }, "baking_rights": { "block_hash": "Block Hash", diff --git a/src/reducers/app/thunks.ts b/src/reducers/app/thunks.ts index f53f6b75..51c4ac9c 100644 --- a/src/reducers/app/thunks.ts +++ b/src/reducers/app/thunks.ts @@ -235,6 +235,8 @@ export const fetchInitEntityAction = ( }; }); + const headLevel = (await TezosConseilClient.getBlock(serverInfo, network, 'head')).level; + predicates.forEach((predicate: any) => { const selectedAttribute: any = attributes.find((attr) => attr.name === predicate.field); if (selectedAttribute.dataType === AttrbuteDataType.DATETIME) { @@ -243,6 +245,10 @@ export const fetchInitEntityAction = ( predicate.set[i] = new Date().getTime() + predicate.set[i]; } } + } else if (selectedAttribute.dataType === AttrbuteDataType.INT || selectedAttribute.name === 'block_level') { + if (predicate.set.length === 1 && Number(predicate.set[0]) < 0) { + predicate.set[0] = headLevel + Number(predicate.set[0]); + } } }); @@ -351,7 +357,7 @@ export const fetchTopBakers = (date: number, limit: number) => async (dispatch: dispatch(setTopBakersQueryUrl(queryUrl)); dispatch(setTopBakers(result)); dispatch(setTopBakersLoadingAction(false)); - } catch (e) { + } catch (e: any) { const message = e.message || `Unable to load baker data for Home page.`; await dispatch(createMessageAction(message, true)); } @@ -520,7 +526,7 @@ export const initLoad = (props: InitLoad) => async (dispatch: any, state: any) = !isQuery && id && (await dispatch(loadModal(config.platform, config.network, id))); await dispatch(completeFullLoadAction(true)); - } catch (e) { + } catch (e: any) { if (e.message) { await dispatch(createMessageAction(e.message, true)); } else { diff --git a/src/utils/defaultQueries.ts b/src/utils/defaultQueries.ts index a213eb3c..b674cbb3 100644 --- a/src/utils/defaultQueries.ts +++ b/src/utils/defaultQueries.ts @@ -1,7 +1,7 @@ const ethereumQueries: any = { blocks: { fields: [ - "timestamp","level","hash","miner","gas_used","total_difficulty","receipts_root", 'transactions_root' + 'timestamp', 'level', 'hash', 'miner', 'gas_used', 'total_difficulty', 'receipts_root', 'transactions_root' ], predicates: [ // { field: 'timestamp', operation: 'after', set: [-1966080000], inverse: false } @@ -9,15 +9,15 @@ const ethereumQueries: any = { orderBy: [ { field: 'level', direction: 'desc' } ], - aggregation:[], + aggregation: [], limit: 5000 }, transactions: { - fields: ["block_hash","block_number","hash","source","destination","amount","gas","input","nonce"], + fields: ['block_hash', 'block_number', 'hash', 'source', 'destination', 'amount', 'gas', 'input', 'nonce'], predicates: [ // { field: 'kind', set: ['transaction'], operation: 'eq', inverse: false }, // { field: 'timestamp', set: [-1966080000], operation: 'after', inverse: false }, - // { field: "status", operation: "eq", set: ['applied'], inverse: false} + // { field: 'status', operation: 'eq', set: ['applied'], inverse: false} ], orderBy: [ { field: 'block_number', direction: 'desc' } @@ -26,20 +26,20 @@ const ethereumQueries: any = { }, contracts: { fields: [], - predicates:[ + predicates: [ // { field: 'balance', operation: 'gt', set:[0], inverse: false }, // { field: 'block_level', operation: 'gt', set: [805066], inverse: false } ], orderBy: [ - { field: "block_number", direction: "desc"} + { field: 'block_number', direction: 'desc' } ], aggregation: [], limit: 5000 }, /*logs: { - fields: ["block_number","block_hash","address","transaction_hash","data","topics"], + fields: ['block_number','block_hash','address','transaction_hash','data','topics'], predicates:[ - { field: 'removed', operation: 'eq', set:["false"], inverse: false } + { field: 'removed', operation: 'eq', set:['false'], inverse: false } ], orderBy: [ { field: 'block_level', direction: 'desc' } @@ -48,13 +48,13 @@ const ethereumQueries: any = { limit: 5000 }*/ receipts: { - fields: [ "block_number","block_hash","transaction_hash","contract_address","gas_used","logs_bloom","root"], - predicates:[ + fields: ['block_number', 'block_hash', 'transaction_hash', 'contract_address', 'gas_used', 'logs_bloom', 'root'], + predicates: [ // { field: 'balance', operation: 'gt', set:[0], inverse: false }, // { field: 'block_level', operation: 'gt', set: [805066], inverse: false } ], orderBy: [ - { field: "block_number", direction: "desc"} + { field: 'block_number', direction: 'desc' } ], aggregation: [], limit: 5000 @@ -66,22 +66,22 @@ const tezosQueries: any = { fields: ['timestamp', 'meta_voting_period', 'meta_cycle', 'level', 'baker', 'hash', 'priority'], predicates: [{ field: 'timestamp', operation: 'after', set: [-1966080000], inverse: false }], orderBy: [{ field: 'level', direction: 'desc' }], - aggregation:[], + aggregation: [], limit: 5000 }, operations: { - fields: ['timestamp', 'block_level', 'source', 'destination', 'amount', 'kind', 'fee', 'status', 'operation_group_hash'], + fields: ['timestamp', 'block_level', 'source', 'destination', 'amount', 'fee', 'operation_group_hash'], predicates: [ { field: 'kind', set: ['transaction'], operation: 'eq', inverse: false }, { field: 'timestamp', set: [-1966080000], operation: 'after', inverse: false }, - { field: "status", operation: "eq", set: ['applied'], inverse: false}], + { field: 'status', operation: 'eq', set: ['applied'], inverse: false }], orderBy: [{ field: 'timestamp', direction: 'desc' }], limit: 5000 }, accounts: { fields: ['block_level', 'account_id', 'balance', 'delegate_value', 'storage', 'counter'], - predicates:[ - { field: 'balance', operation: 'gt', set:[0], inverse: false }, + predicates: [ + { field: 'balance', operation: 'gt', set: [0], inverse: false }, { field: 'block_level', operation: 'gt', set: [805066], inverse: false }], orderBy: [{ field: 'block_level', direction: 'desc' }], aggregation: [], @@ -100,71 +100,70 @@ const tezosQueries: any = { limit: 5000 }, balance_updates: { - "fields": [], - "predicates": [], - "orderBy": [ - { - "field": "block_level", - "direction": "desc" - } - ], - "aggregation": [], - limit: 5000 + fields: ['block_level', 'account_id', 'source', 'change', 'kind', 'operation_group_hash'], + predicates: [{ field: 'block_level', operation: 'gt', set: [-10], inverse: false }], + orderBy: [ + { + field: 'block_level', + direction: 'desc' + } + ], + aggregation: [], + limit: 5000 }, bakers: { - fields: ["pkh", "balance", "rolls", "delegated_balance", "frozen_balance", "staking_balance", "block_level"], - predicates: [{ field: "deactivated", operation: "eq", set: ["false"] }, - { field: "rolls", operation: "gt", set: [0] }], - orderBy: [{ field: "block_level", direction: "desc" }], + fields: ['pkh', 'balance', 'rolls', 'delegated_balance', 'frozen_balance', 'staking_balance', 'block_level'], + predicates: [{ field: 'deactivated', operation: 'eq', set: ['false'] }, + { field: 'rolls', operation: 'gt', set: [0] }], + orderBy: [{ field: 'block_level', direction: 'desc' }], aggregation: [], limit: 5000 }, governance: { - fields:["proposal_hash","voting_period_kind","yay_count","yay_rolls","pass_count","pass_rolls","nay_count","nay_rolls","level"], + fields: ['proposal_hash', 'voting_period_kind', 'yay_count', 'yay_rolls', 'pass_count', 'pass_rolls', 'nay_count', 'nay_rolls', 'level'], predicates: [], - orderBy: [{field:"max_level", direction: "desc"}], + orderBy: [{ field: 'max_level', direction: 'desc' }], aggregation: [ - {field:"level", function:"max"}, - {field:"yay_count", function:"max"}, - {field:"yay_rolls", function:"max"}, - {field:"pass_count", function:"max"}, - {field:"pass_rolls", function:"max"}, - {field:"nay_count", function:"max"}, - {field:"nay_rolls", function:"max"}], + { field: 'level', function: 'max' }, + { field: 'yay_count', function: 'max' }, + { field: 'yay_rolls', function: 'max' }, + { field: 'pass_count', function: 'max' }, + { field: 'pass_rolls', function: 'max' }, + { field: 'nay_count', function: 'max' }, + { field: 'nay_rolls', function: 'max' }], limit: 5000 }, baking_rights: { fields: ['block_level', 'priority', 'delegate', 'estimated_time'], - predicates: [{ field: 'priority', operation: 'in', set: ['0','1'], inverse: false }, { field: 'estimated_time', operation: 'after', set: [-1966080000], inverse: false}], - orderBy: [{ field: 'block_level', direction: 'desc'}], + predicates: [{ field: 'priority', operation: 'in', set: ['0', '1'], inverse: false }, { field: 'estimated_time', operation: 'after', set: [-1966080000], inverse: false }], + orderBy: [{ field: 'block_level', direction: 'desc' }], aggregation: [], limit: 5000 }, endorsing_rights: { fields: ['block_level', 'slot', 'delegate', 'estimated_time'], - predicates: [{ field: 'estimated_time', operation: 'after', set: [-1966080000], inverse: false}], + predicates: [{ field: 'estimated_time', operation: 'after', set: [-1966080000], inverse: false }], orderBy: [{ field: 'block_level', direction: 'desc' }], aggregation: [], limit: 5000 }, accounts_history: { fields: ['asof', 'block_level', 'account_id', 'balance', 'delegate_value', 'storage', 'counter'], - predicates: [{field: 'asof', operation: 'after', set:[-1966080000], inverse:false}], - orderBy: [{field: 'block_level', direction: 'desc'}], + predicates: [{ field: 'asof', operation: 'after', set: [-1966080000], inverse: false }], + orderBy: [{ field: 'block_level', direction: 'desc' }], aggregation: [], limit: 5000 - } }; const bitcoinQueries: any = { blocks: { fields: [ - "time", "height", "hash", "difficulty", "nonce" + 'time', 'height', 'hash', 'difficulty', 'nonce' ], - predicates:[ ], + predicates: [], orderBy: [ - { field: "height", direction: "desc"} + { field: 'height', direction: 'desc' } ], aggregation: [], limit: 5000 @@ -172,19 +171,19 @@ const bitcoinQueries: any = { transactions: { fields: [], predicates: [], - orderBy: [ { field: "block_height", direction: "desc" } ], + orderBy: [{ field: 'block_height', direction: 'desc' }], limit: 100 }, outputs: { fields: [], predicates: [], - orderBy: [ { field: "block_height", direction: "desc" } ], + orderBy: [{ field: 'block_height', direction: 'desc' }], limit: 100 }, inputs: { fields: [], predicates: [], - orderBy: [ { field: "block_height", direction: "desc" } ], + orderBy: [{ field: 'block_height', direction: 'desc' }], limit: 100 } }