Skip to content

Commit

Permalink
Merge pull request #460 from Cryptonomic/pre11
Browse files Browse the repository at this point in the history
Conseil-release update
  • Loading branch information
anonymoussprocket authored Oct 16, 2020
2 parents be63df7 + 6d186ac commit 7ad7816
Show file tree
Hide file tree
Showing 11 changed files with 11,031 additions and 10,631 deletions.
21,533 changes: 10,939 additions & 10,594 deletions package-lock.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "arronax",
"version": "9.0.0",
"version": "10.0.0",
"description": "Blockchain analytics and business intelligence tool for the Tezos chain.",
"author": "Cryptonomic",
"license": "GPL-3.0",
Expand Down Expand Up @@ -47,7 +47,7 @@
"react-moment": "^0.9.7",
"react-redux": "^7.1.3",
"react-router-dom": "^5.2.0",
"react-scripts": "3.4.1",
"react-scripts": "^3.4.3",
"react-swipeable-views": "^0.13.9",
"redux": "^4.0.5",
"redux-devtools-extension": "^2.13.8",
Expand Down
41 changes: 33 additions & 8 deletions public/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,13 @@
"tokenAdmin": "Token Admin",
"tokenSvpply": "Token Supply",
"admin": "Admin",
"maps": "Maps"
"maps": "Maps",
"tokenSupply": "Supply"
},
"block": {},
"contract": {
"active": "Active"
},
"operation": {
"at_level": "at level {{level}}",
"in_cycle": "in cycle {{cycle}}",
Expand Down Expand Up @@ -120,7 +124,8 @@
"big_maps": "Map Definitons",
"big_map_contents": "Map Content",
"known_addresses": "Known Addresses",
"baker_registry": "TCF Baker Registry"
"baker_registry": "TCF Baker Registry",
"bakers_history": "Baker History"
}
},
"attributes": {
Expand Down Expand Up @@ -154,17 +159,21 @@
"is_activated": "Activated Account"
},
"balance_updates": {
"id": "Id",
"account_id": "Address",
"source": "Source",
"source_id": "Source id",
"source_hash": "Source Hash",
"kind": "Kind",
"contract": "Contract",
"change": "Change",
"level": "Level",
"block_level": "Block Level",
"delegate": "Delegate",
"category": "Category",
"operation_group_hash": "Op Group Hash"
"operation_group_hash": "Op Group Hash",
"block_id": "Block Hash",
"cycle": "Cycle",
"level": "Level",
"period": "Period"
},
"ballots": {
"pkh": "Address",
Expand Down Expand Up @@ -286,7 +295,7 @@
"block_hash": "Block Hash",
"delegate": "Baker",
"estimated_time": "Estimated Time",
"level": "Block Level",
"block_level": "Block Level",
"priority": "Priority",
"cycle": "Cycle",
"governance_period": "Period"
Expand All @@ -296,7 +305,7 @@
"endorsed_block": "Endorsed Block",
"delegate": "Baker",
"estimated_time": "Estimated Time",
"level": "Block Level",
"block_level": "Block Level",
"slot": "Slot",
"cycle": "Cycle",
"governance_period": "Period"
Expand Down Expand Up @@ -326,7 +335,8 @@
"account_id": "Address",
"id": "Id",
"name": "Name",
"contract_type": "Type"
"contract_type": "Type",
"scale": "Decimals"
},
"originated_account_maps":{
"big_map_id": "Map Index",
Expand Down Expand Up @@ -377,6 +387,21 @@
"overdelegation_threshold": "Overdelegation threshold",
"subtract_rewards_from_uninvited_delegation": "Subtract rewards from uninvited delegation",
"record_manager": "Record manager"
},
"bakers_history": {
"pkh": "Address",
"asof": "As of Date",
"balance": "Balance",
"block_id":"Block Hash",
"block_level": "Block Level",
"cycle": "Cycle",
"deactivated": "Deactivated",
"delegated_balance": "Delegated Balance",
"frozen_balance": "Frozen Balance",
"grace_period": "Grace period",
"period": "Period",
"rolls": "Rolls",
"staking_balance": "Staking Balance"
}
},
"operators": {
Expand Down
1 change: 0 additions & 1 deletion src/components/SettingsPanel/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ const CloseIconWrapper = styled(CloseIcon)`

const SwipeableViewsWrapper = styled(SwipeableViews)`
&&& {
overflow-x: visible !important;
[aria-hidden="true"] > div > div {
opacity: 0;
}
Expand Down
22 changes: 10 additions & 12 deletions src/containers/CustomTable/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class CustomTable extends React.Component<Props, State> {
EntityModal: any = null;
tableEl: React.RefObject<any>;
rootEl: null | Element;
tableAnchor = 0;
constructor(props: Props) {
super(props);
this.state = {
Expand All @@ -31,6 +32,7 @@ class CustomTable extends React.Component<Props, State> {
this.setState({
tableDetails: this.tableEl.current.getBoundingClientRect(),
});
this.tableAnchor = this.tableEl.current.offsetTop;
}

componentWillUnmount() {
Expand All @@ -39,21 +41,17 @@ class CustomTable extends React.Component<Props, State> {
}

syncScroll = (e: any) => {
if (!this.tableEl.current || e.target !== this.rootEl) {
return;
}
if (!this.tableEl.current) { return; }
if (!this.rootEl) { console.log('null root'); return;}

const tableTop = this.tableEl.current.getBoundingClientRect().top;
if (tableTop === 0) {
const tableOffset = this.tableEl.current.scrollHeight - this.tableEl.current.clientHeight;
const bodyOffset = e.target.scrollHeight - e.target.clientHeight;
this.tableEl.current.scrollTop = (tableOffset * e.target.scrollTop) / bodyOffset;
} else if (tableTop > 0) {
if (window.scrollY > this.tableAnchor && window.scrollY < this.tableEl.current.scrollHeight) { // scrolling inside
this.tableEl.current.scrollTop = window.scrollY - this.tableAnchor
} else if (window.scrollY < this.tableAnchor) { // scrolling above
this.tableEl.current.scrollTop = 0;
} else if (tableTop < 0) {
this.tableEl.current.scrollTop = this.tableEl.current.scrollHeight;
} else if (window.scrollY > this.tableEl.current.scrollHeight + this.tableAnchor) { // scrolling below
this.tableEl.current.scrollTop = this.tableEl.current.scrollHeight - this.tableAnchor - window.scrollY
}
};
}

handleRequestSort = async (orderBy: string) => {
const { selectedSort, selectedEntity, onSetSort, onSubmitQuery } = this.props;
Expand Down
2 changes: 1 addition & 1 deletion src/containers/Modal/templates/tezos/mainnet/block.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const Block = (props: any) => {
const { t } = useTranslation();
const [tab, setTab] = useState('');
const { platform, network, entity, values, attributes, formatValue } = props;
const explicitKeys: string[] = [];
const explicitKeys: string[] = ['utc_year', 'utc_month', 'utc_day', 'utc_time'];
const title = t('components.entityModal.details', { title: 'Block' });
let tableCols: any = [];
let tableItems: any = null;
Expand Down
17 changes: 16 additions & 1 deletion src/containers/Modal/templates/tezos/mainnet/contract.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const Contract = (props: any) => {
const contract = useSelector(({ modal }: any) => modal.modules.contract, shallowEqual);
const { t } = useTranslation();
const { platform, network, entity, values, attributes, formatValue, formatSpecificValue } = props;
const explicitKeys: string[] = ['is_baker']; // do not render Baker field
const explicitKeys: string[] = ['is_baker', 'is_activated']; // do not render Baker field
const title = t('components.entityModal.details', { title: 'Contract' });

let list: any = [
Expand Down Expand Up @@ -67,6 +67,21 @@ const Contract = (props: any) => {
title: t('components.entityModal.account.tokenSupply'),
value: formatSpecificValue(platform, network, entity, contract.metadata.supply, AttrbuteDataType.DECIMAL, true),
});
contractList.push({
title: t('components.entityModal.contract.active'),
value: formatSpecificValue(platform, network, entity, !contract.metadata.paused, AttrbuteDataType.BOOLEAN, true),
});
}

if (contract?.type?.startsWith('StakerDAO Token')) {
contractList.push({
title: t('components.entityModal.account.tokenSupply'),
value: formatSpecificValue(platform, network, entity, contract.metadata.supply, AttrbuteDataType.DECIMAL, true),
});
contractList.push({
title: t('components.entityModal.contract.active'),
value: formatSpecificValue(platform, network, entity, !contract.metadata.paused, AttrbuteDataType.BOOLEAN, true),
});
}

if (contract?.type === 'Babylon Delegation Contract') {
Expand Down
2 changes: 1 addition & 1 deletion src/containers/Modal/templates/tezos/mainnet/operation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { ArronaxIcon } from '../../../../../components/ArronaxIcon';
const Operation = (props: any) => {
const { t } = useTranslation();
const { platform, network, entity, items, values, attributes, formatValue, count, setCount } = props;
const explicitKeys: string[] = [];
const explicitKeys: string[] = ['utc_year', 'utc_month', 'utc_day', 'utc_time', 'period'];
const explicitMinorKeys: string[] = [];
const total = items[entity] ? items[entity].length : 0;
const kind = values.find((a: any) => a.name === 'kind');
Expand Down
23 changes: 19 additions & 4 deletions src/reducers/modal/thunk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
TezosConseilClient,
BabylonDelegationHelper,
Tzip7ReferenceTokenHelper,
StakerDAOTokenHelper,
TezosContractIntrospector,
} from 'conseiljs';

Expand Down Expand Up @@ -47,7 +48,7 @@ export const fetchContract = (name: string, data: any) => async (dispatch: any,
const storage = await BabylonDelegationHelper.getSimpleStorage(config.nodeUrl || '', id);
metadata.manager = storage.administrator;
}
} catch (e) {}
} catch (e) { }

try {
if (Tzip7ReferenceTokenHelper.verifyScript(script)) {
Expand All @@ -56,10 +57,24 @@ export const fetchContract = (name: string, data: any) => async (dispatch: any,
const storage = await Tzip7ReferenceTokenHelper.getSimpleStorage(config.nodeUrl || '', id);
metadata.manager = storage.administrator;
metadata.supply = storage.supply;
//storage.mapid
//storage.paused
metadata.balanceLedger = storage.mapid;
metadata.paused = storage.paused;
}
} catch (e) {}
} catch (e) { }

try {
if (data.id === 'KT1LN4LPSqTMS7Sd2CJw4bbDGRkMv2t68Fy9') { // USDtz
metadata.supply = metadata.supply / 1_000_000;
} else if (data.id === 'KT1PWx2mnDueood7fEmfbBDKx1D9BAnnXitn') { // tzBTC
//
} else if (data.id === 'KT1EctCuorV2NfVb1XTQgvzJ88MQtWP8cMMv') { // StakerDao
const storage = await StakerDAOTokenHelper.getSimpleStorage(config.nodeUrl || '', id);
metadata.supply = storage.supply;
metadata.balanceLedger = storage.mapid;
metadata.paused = storage.paused;
contractType = 'StakerDAO Token';
}
} catch (e) { }

try {
const mapData = await TezosConseilClient.getBigMapData({ url: config.url, apiKey: config.apiKey, network: config.network }, id);
Expand Down
8 changes: 4 additions & 4 deletions src/utils/defaultQueries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,16 +71,16 @@ export const defaultQueries: any = {
limit: 1000
},
baking_rights: {
fields: ['level', 'priority', 'delegate', 'estimated_time'],
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: 'level', direction: 'desc'}],
orderBy: [{ field: 'block_level', direction: 'desc'}],
aggregation: [],
limit: 1000
},
endorsing_rights: {
fields: ['level', 'slot', 'delegate', 'estimated_time'],
fields: ['block_level', 'slot', 'delegate', 'estimated_time'],
predicates: [{ field: 'estimated_time', operation: 'after', set: [-1966080000], inverse: false}],
orderBy: [{ field: 'level', direction: 'desc' }],
orderBy: [{ field: 'block_level', direction: 'desc' }],
aggregation: [],
limit: 1000
},
Expand Down
9 changes: 6 additions & 3 deletions src/utils/general.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@ export const formatNumber = (value: number, attribute: AttributeDefinition, trun
if (!truncate) {
minimumFractionDigits = 6;
maximumFractionDigits = 6;
} else if (value < 10000) {
} else if (Math.abs(value) < 10000) {
minimumFractionDigits = 6;
maximumFractionDigits = 6;
} else if (value < 100000) {
} else if (Math.abs(value) < 100000) {
minimumFractionDigits = 4;
maximumFractionDigits = 4;
} else if (value < 1000000000) {
} else if (Math.abs(value) < 1000000000) {
minimumFractionDigits = 2;
maximumFractionDigits = 2;
}
Expand Down Expand Up @@ -85,6 +85,9 @@ export const getOperatorType = (dataType: string) => {
if (dataType === AttrbuteDataType.BOOLEAN) {
return 'boolean';
}

if (dataType.toLowerCase().includes('int')) { return 'numeric'; } // HACK

return 'dateTime';
}

Expand Down

0 comments on commit 7ad7816

Please sign in to comment.