Skip to content

Commit

Permalink
add publicKeyToAddress (#98)
Browse files Browse the repository at this point in the history
  • Loading branch information
puncsky authored Mar 22, 2019
1 parent d6b1269 commit b5a8f0c
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 16 deletions.
23 changes: 12 additions & 11 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
module.exports = {
presets: [
['@babel/preset-env', {
targets: {
node: 'current',
},
}],
['@babel/preset-react'],
['@babel/preset-typescript'],
],
plugins: [],
ignore: [
/node_modules\/(?!onefx)/g,
[
"@babel/preset-env",
{
targets: {
node: "current"
}
}
],
["@babel/preset-react"],
["@babel/preset-typescript"]
],
plugins: ["@babel/plugin-proposal-class-properties"],
ignore: [/node_modules\/(?!onefx)/g]
};
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@
"dependencies": {
"@babel/cli": "7.2.3",
"@babel/core": "7.3.4",
"@babel/plugin-proposal-class-properties": "^7.4.0",
"@babel/preset-env": "7.3.4",
"@babel/preset-react": "7.0.0",
"@babel/preset-typescript": "7.3.3",
Expand Down Expand Up @@ -143,7 +144,7 @@
"graphql": "14.1.1",
"graphql-iso-date": "3.6.1",
"graphql-tag": "2.10.1",
"iotex-antenna": "^0.3.0",
"iotex-antenna": "0.4.0",
"is-browser": "2.1.0",
"isomorphic-unfetch": "3.0.0",
"jsdom": "12.2.0",
Expand Down
9 changes: 6 additions & 3 deletions src/shared/address-details/action-table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { Query } from "react-apollo";
import { Action } from "../../api-gateway/resolvers/antenna-types";
import { SpinPreloader } from "../common/spin-preloader";
import { GET_ACTIONS } from "../queries";
import { publicKeyToAddress } from "iotex-antenna/lib/crypto/crypto";

function getColumns(): Array<ColumnProps<Action>> {
return [
Expand Down Expand Up @@ -36,7 +37,11 @@ function getColumns(): Array<ColumnProps<Action>> {
record.core.execution ||
record.core.grantReward ||
record.core.transfer;
return JSON.stringify(other, null, 2);
return JSON.stringify(
{ ...other, sender: publicKeyToAddress(String(record.senderPubKey)) },
null,
2
);
}
}
];
Expand All @@ -62,8 +67,6 @@ export function ActionTable({ address }: { address: string }): JSX.Element {
return (
<SpinPreloader spinning={loading}>
<Table columns={getColumns()} dataSource={actions} />

<pre>{JSON.stringify(data, null, 2)}</pre>
</SpinPreloader>
);
}}
Expand Down
3 changes: 2 additions & 1 deletion src/shared/address-details/address-details.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ class AddressDetailsInner extends PureComponent<Props> {
</div>
<div className={"name"}>balance</div>
<div className={"info"}>{`${utils.fromRau(
(addressInfo && addressInfo.balance) || 0
String(addressInfo && addressInfo.balance),
"IOTX"
)} IOTX`}</div>
</div>
<div className={"item"}>
Expand Down
12 changes: 12 additions & 0 deletions translations/en.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ candidates.election.NOT_ELECTED: Not Elected
candidates.election.UNQUALIFIED: Not Elected
candidates.election.explain: >-
Delegates must self-stake at least <b>1,200,000 IOTX</b> and earn <b>2,000,000 IOTX</b> total votes to be elected.
# block.block is the title of the page block
block.block: Block
# block.blocks is the title of page blocks that lists a table of blocks
block.blocks: Blocks
# block.height is the table column field name describing the height of the block in the blockchain.
Expand All @@ -41,3 +43,13 @@ block.tx_root: Tx Root
block.receipt_root: Receipt Root
# block.delta_state_digest is the digest value of the delta state with the last block.
block.delta_state_digest: Digest of Delta State
# action.type
action.type: Type
# action.type.transfer
action.type.transfer: Transfer
# action.type.grant_reward
action.type.grant_reward: Grant Reward
# action.type.execution
action.type.execution: Execution
# action.data
action.data: Data
10 changes: 10 additions & 0 deletions translations/zh-cn.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,13 @@ block.tx_root: Tx Root
block.receipt_root: Receipt Root
# block.delta_state_digest is the digest value of the delta state with the last block.
block.delta_state_digest: Digest of Delta State
# action.type
action.type: Type
# action.type.transfer
action.type.transfer: Transfer
# action.type.grant_reward
action.type.grant_reward: Grant Reward
# action.type.execution
action.type.execution: Execution
# action.data
action.data: Data

0 comments on commit b5a8f0c

Please sign in to comment.