Skip to content
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

Misc changes #515

Open
wants to merge 4 commits into
base: trunk
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand Down
4 changes: 3 additions & 1 deletion public/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
10 changes: 8 additions & 2 deletions src/reducers/app/thunks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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]);
}
}
});

Expand Down Expand Up @@ -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));
}
Expand Down Expand Up @@ -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 {
Expand Down
101 changes: 50 additions & 51 deletions src/utils/defaultQueries.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
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 }
],
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' }
Expand All @@ -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' }
Expand All @@ -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
Expand All @@ -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: [],
Expand All @@ -100,91 +100,90 @@ 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
},
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
}
}
Expand Down